mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-27 20:35:09 +00:00
Merge #4614
4614: Fix some clippy perf warnings r=kjeremy a=kjeremy Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
This commit is contained in:
commit
76fa498d6c
4 changed files with 8 additions and 9 deletions
|
@ -267,8 +267,8 @@ impl From<&FixtureMeta> for ParsedMeta {
|
||||||
ParsedMeta::Root { path: path.to_owned() }
|
ParsedMeta::Root { path: path.to_owned() }
|
||||||
}
|
}
|
||||||
FixtureMeta::File(f) => Self::File(FileMeta {
|
FixtureMeta::File(f) => Self::File(FileMeta {
|
||||||
path: f.path.to_owned().into(),
|
path: f.path.to_owned(),
|
||||||
krate: f.crate_name.to_owned().into(),
|
krate: f.crate_name.to_owned(),
|
||||||
deps: f.deps.to_owned(),
|
deps: f.deps.to_owned(),
|
||||||
cfg: f.cfg.to_owned(),
|
cfg: f.cfg.to_owned(),
|
||||||
edition: f
|
edition: f
|
||||||
|
|
|
@ -164,7 +164,7 @@ impl LangItems {
|
||||||
T: Into<AttrDefId> + Copy,
|
T: Into<AttrDefId> + Copy,
|
||||||
{
|
{
|
||||||
if let Some(lang_item_name) = lang_attr(db, item) {
|
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 self_trait_ref = TraitRef { trait_, substs: self_substs };
|
||||||
let where_clauses = vec![GenericPredicate::Implemented(self_trait_ref)];
|
let where_clauses = vec![GenericPredicate::Implemented(self_trait_ref)];
|
||||||
|
|
||||||
let impl_substs =
|
let impl_substs = Substs::builder(2).push(self_ty).push(Ty::Dyn(target_bounds.into())).build();
|
||||||
Substs::builder(2).push(self_ty).push(Ty::Dyn(target_bounds.clone().into())).build();
|
|
||||||
|
|
||||||
let trait_ref = TraitRef { trait_: unsize_trait, substs: impl_substs };
|
let trait_ref = TraitRef { trait_: unsize_trait, substs: impl_substs };
|
||||||
|
|
||||||
|
|
|
@ -196,10 +196,10 @@ fn find(pattern: &SsrPattern, code: &SyntaxNode) -> SsrMatches {
|
||||||
) -> Option<Match> {
|
) -> Option<Match> {
|
||||||
let match_ = check_opt_nodes(pattern.path(), code.path(), placeholders, match_)?;
|
let match_ = check_opt_nodes(pattern.path(), code.path(), placeholders, match_)?;
|
||||||
|
|
||||||
let mut pattern_fields =
|
let mut pattern_fields: Vec<RecordField> =
|
||||||
pattern.record_field_list().map(|x| x.fields().collect()).unwrap_or(vec![]);
|
pattern.record_field_list().map(|x| x.fields().collect()).unwrap_or_default();
|
||||||
let mut code_fields =
|
let mut code_fields: Vec<RecordField> =
|
||||||
code.record_field_list().map(|x| x.fields().collect()).unwrap_or(vec![]);
|
code.record_field_list().map(|x| x.fields().collect()).unwrap_or_default();
|
||||||
|
|
||||||
if pattern_fields.len() != code_fields.len() {
|
if pattern_fields.len() != code_fields.len() {
|
||||||
return None;
|
return None;
|
||||||
|
|
Loading…
Reference in a new issue