mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
remove more redundant clones manually
This commit is contained in:
parent
476e10e961
commit
b22bd36f6e
4 changed files with 3 additions and 5 deletions
|
@ -233,7 +233,6 @@ impl InferenceContext<'_> {
|
||||||
};
|
};
|
||||||
let mut expectations_iter = expectations
|
let mut expectations_iter = expectations
|
||||||
.iter()
|
.iter()
|
||||||
.cloned()
|
|
||||||
.map(|a| a.assert_ty_ref(Interner).clone())
|
.map(|a| a.assert_ty_ref(Interner).clone())
|
||||||
.chain(repeat_with(|| self.table.new_type_var()));
|
.chain(repeat_with(|| self.table.new_type_var()));
|
||||||
|
|
||||||
|
|
|
@ -3673,7 +3673,6 @@ impl Closure {
|
||||||
let (captures, _) = infer.closure_info(&self.id);
|
let (captures, _) = infer.closure_info(&self.id);
|
||||||
captures
|
captures
|
||||||
.iter()
|
.iter()
|
||||||
.cloned()
|
|
||||||
.map(|capture| Type {
|
.map(|capture| Type {
|
||||||
env: db.trait_environment_for_body(owner),
|
env: db.trait_environment_for_body(owner),
|
||||||
ty: capture.ty(&self.subst),
|
ty: capture.ty(&self.subst),
|
||||||
|
|
|
@ -79,7 +79,7 @@ pub(crate) fn goto_definition(
|
||||||
return Some(vec![x]);
|
return Some(vec![x]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(x) = try_lookup_macro_def_in_macro_use(sema, token.clone()) {
|
if let Some(x) = try_lookup_macro_def_in_macro_use(sema, token) {
|
||||||
return Some(vec![x]);
|
return Some(vec![x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ impl FieldOrTupleIdx {
|
||||||
.as_str()
|
.as_str()
|
||||||
.map(|s| s.to_owned())
|
.map(|s| s.to_owned())
|
||||||
.unwrap_or_else(|| format!(".{}", f.name(db).as_tuple_index().unwrap())),
|
.unwrap_or_else(|| format!(".{}", f.name(db).as_tuple_index().unwrap())),
|
||||||
FieldOrTupleIdx::TupleIdx(i) => format!(".{i}").to_owned(),
|
FieldOrTupleIdx::TupleIdx(i) => format!(".{i}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ pub(crate) fn view_memory_layout(
|
||||||
|
|
||||||
let mut nodes = vec![MemoryLayoutNode {
|
let mut nodes = vec![MemoryLayoutNode {
|
||||||
item_name,
|
item_name,
|
||||||
typename: typename.clone(),
|
typename,
|
||||||
size: layout.size(),
|
size: layout.size(),
|
||||||
offset: 0,
|
offset: 0,
|
||||||
alignment: layout.align(),
|
alignment: layout.align(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue