mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Fix a few clippy::perf warnings
This commit is contained in:
parent
cc49502ab4
commit
f9bb398cc5
8 changed files with 14 additions and 12 deletions
|
@ -519,7 +519,7 @@ impl Config {
|
|||
.data
|
||||
.checkOnSave_target
|
||||
.clone()
|
||||
.or(self.data.cargo_target.clone()),
|
||||
.or_else(|| self.data.cargo_target.clone()),
|
||||
all_targets: self.data.checkOnSave_allTargets,
|
||||
no_default_features: self
|
||||
.data
|
||||
|
@ -533,7 +533,7 @@ impl Config {
|
|||
.data
|
||||
.checkOnSave_features
|
||||
.clone()
|
||||
.unwrap_or(self.data.cargo_features.clone()),
|
||||
.unwrap_or_else(|| self.data.cargo_features.clone()),
|
||||
extra_args: self.data.checkOnSave_extraArgs.clone(),
|
||||
},
|
||||
};
|
||||
|
@ -731,7 +731,7 @@ fn get_field<T: DeserializeOwned>(
|
|||
fn schema(fields: &[(&'static str, &'static str, &[&str], &str)]) -> serde_json::Value {
|
||||
for ((f1, ..), (f2, ..)) in fields.iter().zip(&fields[1..]) {
|
||||
fn key(f: &str) -> &str {
|
||||
f.splitn(2, "_").next().unwrap()
|
||||
f.splitn(2, '_').next().unwrap()
|
||||
}
|
||||
assert!(key(f1) <= key(f2), "wrong field order: {:?} {:?}", f1, f2);
|
||||
}
|
||||
|
|
|
@ -891,10 +891,10 @@ pub(crate) fn code_lens(
|
|||
|
||||
let id = lsp_types::TextDocumentIdentifier { uri: url.clone() };
|
||||
|
||||
let doc_pos = lsp_types::TextDocumentPositionParams::new(id.clone(), position);
|
||||
let doc_pos = lsp_types::TextDocumentPositionParams::new(id, position);
|
||||
|
||||
let goto_params = lsp_types::request::GotoImplementationParams {
|
||||
text_document_position_params: doc_pos.clone(),
|
||||
text_document_position_params: doc_pos,
|
||||
work_done_progress_params: Default::default(),
|
||||
partial_result_params: Default::default(),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue