From 4b7f473223a939b702b89b6ef4db59bdbfff32d4 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Wed, 8 Jul 2020 09:45:29 -0400 Subject: Clippy perf warnings --- crates/ra_mbe/src/mbe_expander/matcher.rs | 2 +- crates/ra_proc_macro_srv/src/dylib.rs | 2 +- crates/rust-analyzer/src/global_state.rs | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'crates') diff --git a/crates/ra_mbe/src/mbe_expander/matcher.rs b/crates/ra_mbe/src/mbe_expander/matcher.rs index 78f9efa1b..f9e515b81 100644 --- a/crates/ra_mbe/src/mbe_expander/matcher.rs +++ b/crates/ra_mbe/src/mbe_expander/matcher.rs @@ -260,7 +260,7 @@ impl<'a> TtIter<'a> { | ('|', '=', None) | ('|', '|', None) => { let tt2 = self.next().unwrap().clone(); - Ok(tt::Subtree { delimiter: None, token_trees: vec![tt.clone(), tt2] }.into()) + Ok(tt::Subtree { delimiter: None, token_trees: vec![tt, tt2] }.into()) } _ => Ok(tt), } diff --git a/crates/ra_proc_macro_srv/src/dylib.rs b/crates/ra_proc_macro_srv/src/dylib.rs index aa84e951c..1addbbd54 100644 --- a/crates/ra_proc_macro_srv/src/dylib.rs +++ b/crates/ra_proc_macro_srv/src/dylib.rs @@ -45,7 +45,7 @@ fn find_registrar_symbol(file: &Path) -> io::Result> { // https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dlsym.3.html // Unlike other dyld API's, the symbol name passed to dlsym() must NOT be // prepended with an underscore. - if s.name.starts_with("_") { + if s.name.starts_with('_') { &s.name[1..] } else { &s.name diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 640b3959d..c8d34e15a 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs @@ -204,8 +204,7 @@ impl GlobalState { if let Some((method, start)) = self.req_queue.incoming.complete(response.id.clone()) { let duration = start.elapsed(); log::info!("handled req#{} in {:?}", response.id, duration); - let metrics = - RequestMetrics { id: response.id.clone(), method: method.to_string(), duration }; + let metrics = RequestMetrics { id: response.id.clone(), method, duration }; self.latest_requests.write().record(metrics); self.send(response.into()); } -- cgit v1.2.3