]> git.lizzy.rs Git - rust.git/commitdiff
Clippy perf warnings
authorkjeremy <kjeremy@gmail.com>
Wed, 8 Jul 2020 13:45:29 +0000 (09:45 -0400)
committerkjeremy <kjeremy@gmail.com>
Wed, 8 Jul 2020 13:45:29 +0000 (09:45 -0400)
crates/ra_mbe/src/mbe_expander/matcher.rs
crates/ra_proc_macro_srv/src/dylib.rs
crates/rust-analyzer/src/global_state.rs

index 78f9efa1b6926eb5d1150b6655704b3a67631637..f9e515b81189eab85772469a03810d21c658f5d9 100644 (file)
@@ -260,7 +260,7 @@ pub(crate) fn expect_tt(&mut self) -> Result<tt::TokenTree, ()> {
             | ('|', '=', 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),
         }
index aa84e951cd5601636490c9ffe2f0638a7c2ade1c..1addbbd54fddd462d9c05b6938c058ff1f9604df 100644 (file)
@@ -45,7 +45,7 @@ fn find_registrar_symbol(file: &Path) -> io::Result<Option<String>> {
                     // 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
index 640b3959df21b406f7635ebfc44b9305f0af5cec..c8d34e15a8c9cbd629a89f2995f1f3f06f92b7a0 100644 (file)
@@ -204,8 +204,7 @@ pub(crate) fn respond(&mut self, response: lsp_server::Response) {
         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());
         }