mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Fix some clippy perf warnings
This commit is contained in:
parent
3c2c8d7e5f
commit
a5cc9a8a9b
4 changed files with 8 additions and 9 deletions
|
@ -267,8 +267,8 @@ impl From<&FixtureMeta> for ParsedMeta {
|
|||
ParsedMeta::Root { path: path.to_owned() }
|
||||
}
|
||||
FixtureMeta::File(f) => Self::File(FileMeta {
|
||||
path: f.path.to_owned().into(),
|
||||
krate: f.crate_name.to_owned().into(),
|
||||
path: f.path.to_owned(),
|
||||
krate: f.crate_name.to_owned(),
|
||||
deps: f.deps.to_owned(),
|
||||
cfg: f.cfg.to_owned(),
|
||||
edition: f
|
||||
|
|
|
@ -164,7 +164,7 @@ impl LangItems {
|
|||
T: Into<AttrDefId> + Copy,
|
||||
{
|
||||
if let Some(lang_item_name) = lang_attr(db, item) {
|
||||
self.items.entry(lang_item_name.clone()).or_insert_with(|| constructor(item));
|
||||
self.items.entry(lang_item_name).or_insert_with(|| constructor(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -290,8 +290,7 @@ fn trait_object_unsize_impl_datum(
|
|||
let self_trait_ref = TraitRef { trait_, substs: self_substs };
|
||||
let where_clauses = vec![GenericPredicate::Implemented(self_trait_ref)];
|
||||
|
||||
let impl_substs =
|
||||
Substs::builder(2).push(self_ty).push(Ty::Dyn(target_bounds.clone().into())).build();
|
||||
let impl_substs = Substs::builder(2).push(self_ty).push(Ty::Dyn(target_bounds.into())).build();
|
||||
|
||||
let trait_ref = TraitRef { trait_: unsize_trait, substs: impl_substs };
|
||||
|
||||
|
|
|
@ -196,10 +196,10 @@ fn find(pattern: &SsrPattern, code: &SyntaxNode) -> SsrMatches {
|
|||
) -> Option<Match> {
|
||||
let match_ = check_opt_nodes(pattern.path(), code.path(), placeholders, match_)?;
|
||||
|
||||
let mut pattern_fields =
|
||||
pattern.record_field_list().map(|x| x.fields().collect()).unwrap_or(vec![]);
|
||||
let mut code_fields =
|
||||
code.record_field_list().map(|x| x.fields().collect()).unwrap_or(vec![]);
|
||||
let mut pattern_fields: Vec<RecordField> =
|
||||
pattern.record_field_list().map(|x| x.fields().collect()).unwrap_or_default();
|
||||
let mut code_fields: Vec<RecordField> =
|
||||
code.record_field_list().map(|x| x.fields().collect()).unwrap_or_default();
|
||||
|
||||
if pattern_fields.len() != code_fields.len() {
|
||||
return None;
|
||||
|
|
Loading…
Reference in a new issue