diff options
Diffstat (limited to 'crates/proc_macro_api')
-rw-r--r-- | crates/proc_macro_api/src/msg.rs | 4 | ||||
-rw-r--r-- | crates/proc_macro_api/src/process.rs | 4 | ||||
-rw-r--r-- | crates/proc_macro_api/src/version.rs | 2 |
3 files changed, 4 insertions, 6 deletions
diff --git a/crates/proc_macro_api/src/msg.rs b/crates/proc_macro_api/src/msg.rs index f525df152..899895578 100644 --- a/crates/proc_macro_api/src/msg.rs +++ b/crates/proc_macro_api/src/msg.rs | |||
@@ -59,7 +59,7 @@ pub trait Message: Serialize + DeserializeOwned { | |||
59 | Ok(match read_json(inp, buf)? { | 59 | Ok(match read_json(inp, buf)? { |
60 | None => None, | 60 | None => None, |
61 | Some(text) => { | 61 | Some(text) => { |
62 | let mut deserializer = serde_json::Deserializer::from_str(&text); | 62 | let mut deserializer = serde_json::Deserializer::from_str(text); |
63 | // Note that some proc-macro generate very deep syntax tree | 63 | // Note that some proc-macro generate very deep syntax tree |
64 | // We have to disable the current limit of serde here | 64 | // We have to disable the current limit of serde here |
65 | deserializer.disable_recursion_limit(); | 65 | deserializer.disable_recursion_limit(); |
@@ -92,7 +92,7 @@ fn read_json<'a>( | |||
92 | 92 | ||
93 | // Some ill behaved macro try to use stdout for debugging | 93 | // Some ill behaved macro try to use stdout for debugging |
94 | // We ignore it here | 94 | // We ignore it here |
95 | if !buf.starts_with("{") { | 95 | if !buf.starts_with('{') { |
96 | log::error!("proc-macro tried to print : {}", buf); | 96 | log::error!("proc-macro tried to print : {}", buf); |
97 | continue; | 97 | continue; |
98 | } | 98 | } |
diff --git a/crates/proc_macro_api/src/process.rs b/crates/proc_macro_api/src/process.rs index 99d05aef3..38eac6c17 100644 --- a/crates/proc_macro_api/src/process.rs +++ b/crates/proc_macro_api/src/process.rs | |||
@@ -76,9 +76,7 @@ impl ProcMacroProcessSrv { | |||
76 | .map_err(|_| tt::ExpansionError::Unknown("proc macro server crashed".into()))?; | 76 | .map_err(|_| tt::ExpansionError::Unknown("proc macro server crashed".into()))?; |
77 | 77 | ||
78 | match res { | 78 | match res { |
79 | Some(Response::Error(err)) => { | 79 | Some(Response::Error(err)) => Err(tt::ExpansionError::ExpansionError(err.message)), |
80 | return Err(tt::ExpansionError::ExpansionError(err.message)); | ||
81 | } | ||
82 | Some(res) => Ok(res.try_into().map_err(|err| { | 80 | Some(res) => Ok(res.try_into().map_err(|err| { |
83 | tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err)) | 81 | tt::ExpansionError::Unknown(format!("Fail to get response, reason : {:#?} ", err)) |
84 | })?), | 82 | })?), |
diff --git a/crates/proc_macro_api/src/version.rs b/crates/proc_macro_api/src/version.rs index 6dbac50b4..28a4ac086 100644 --- a/crates/proc_macro_api/src/version.rs +++ b/crates/proc_macro_api/src/version.rs | |||
@@ -95,7 +95,7 @@ fn read_section<'a>(dylib_binary: &'a [u8], section_name: &str) -> io::Result<&' | |||
95 | /// * [version string bytes encoded in utf8] <- GET THIS BOI | 95 | /// * [version string bytes encoded in utf8] <- GET THIS BOI |
96 | /// * [some more bytes that we don really care but still there] :-) | 96 | /// * [some more bytes that we don really care but still there] :-) |
97 | /// Check this issue for more about the bytes layout: | 97 | /// Check this issue for more about the bytes layout: |
98 | /// https://github.com/rust-analyzer/rust-analyzer/issues/6174 | 98 | /// <https://github.com/rust-analyzer/rust-analyzer/issues/6174> |
99 | fn read_version(dylib_path: &Path) -> io::Result<String> { | 99 | fn read_version(dylib_path: &Path) -> io::Result<String> { |
100 | let dylib_file = File::open(dylib_path)?; | 100 | let dylib_file = File::open(dylib_path)?; |
101 | let dylib_mmaped = unsafe { Mmap::map(&dylib_file) }?; | 101 | let dylib_mmaped = unsafe { Mmap::map(&dylib_file) }?; |