Unnamed repository; edit this file 'description' to name the repository.
change callback from FnMut to Fn as we only transform messages and not really change change state
bit-aloo 3 months ago
parent 3ae99fc · commit a1720ac
-rw-r--r--crates/load-cargo/src/lib.rs6
-rw-r--r--crates/proc-macro-api/src/bidirectional_protocol.rs2
-rw-r--r--crates/proc-macro-api/src/process.rs4
3 files changed, 6 insertions, 6 deletions
diff --git a/crates/load-cargo/src/lib.rs b/crates/load-cargo/src/lib.rs
index 8342492a33..ccc9aa4291 100644
--- a/crates/load-cargo/src/lib.rs
+++ b/crates/load-cargo/src/lib.rs
@@ -435,7 +435,7 @@ pub fn load_proc_macro(
) -> ProcMacroLoadResult {
let res: Result<Vec<_>, _> = (|| {
let dylib = MacroDylib::new(path.to_path_buf());
- let vec = server.load_dylib(dylib, Some(&mut reject_subrequests)).map_err(|e| {
+ let vec = server.load_dylib(dylib, Some(&reject_subrequests)).map_err(|e| {
ProcMacroLoadingError::ProcMacroSrvError(format!("{e}").into_boxed_str())
})?;
if vec.is_empty() {
@@ -541,7 +541,7 @@ impl ProcMacroExpander for Expander {
mixed_site: Span,
current_dir: String,
) -> Result<tt::TopSubtree, ProcMacroExpansionError> {
- let mut cb = |req| match req {
+ let cb = |req| match req {
SubRequest::LocalFilePath { file_id } => {
let file_id = FileId::from_raw(file_id);
let source_root_id = db.file_source_root(file_id).source_root_id(db);
@@ -613,7 +613,7 @@ impl ProcMacroExpander for Expander {
call_site,
mixed_site,
current_dir,
- Some(&mut cb),
+ Some(&cb),
) {
Ok(Ok(subtree)) => Ok(subtree),
Ok(Err(err)) => Err(ProcMacroExpansionError::Panic(err)),
diff --git a/crates/proc-macro-api/src/bidirectional_protocol.rs b/crates/proc-macro-api/src/bidirectional_protocol.rs
index cd1f6f6f1f..25266c46fe 100644
--- a/crates/proc-macro-api/src/bidirectional_protocol.rs
+++ b/crates/proc-macro-api/src/bidirectional_protocol.rs
@@ -28,7 +28,7 @@ use crate::{
pub mod msg;
-pub type SubCallback<'a> = &'a mut dyn FnMut(SubRequest) -> Result<SubResponse, ServerError>;
+pub type SubCallback<'a> = &'a dyn Fn(SubRequest) -> Result<SubResponse, ServerError>;
pub fn run_conversation<C: Codec>(
writer: &mut dyn Write,
diff --git a/crates/proc-macro-api/src/process.rs b/crates/proc-macro-api/src/process.rs
index 775d59174f..c1b95fa7f1 100644
--- a/crates/proc-macro-api/src/process.rs
+++ b/crates/proc-macro-api/src/process.rs
@@ -168,7 +168,7 @@ impl ProcMacroServerProcess {
};
let mut srv = create_srv()?;
tracing::info!("sending proc-macro server version check");
- match srv.version_check(Some(&mut reject_subrequests)) {
+ match srv.version_check(Some(&reject_subrequests)) {
Ok(v) if v > version::CURRENT_API_VERSION => {
let process_version = binary_server_version();
err = Some(io::Error::other(format!(
@@ -182,7 +182,7 @@ impl ProcMacroServerProcess {
srv.version = v;
if srv.version >= version::RUST_ANALYZER_SPAN_SUPPORT
&& let Ok(new_mode) =
- srv.enable_rust_analyzer_spans(Some(&mut reject_subrequests))
+ srv.enable_rust_analyzer_spans(Some(&reject_subrequests))
{
match &mut srv.protocol {
Protocol::LegacyJson { mode }