mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
clippy::clone_on_copy
This commit is contained in:
parent
6cc6dee9e9
commit
705f7e6e26
@ -452,7 +452,7 @@ impl Module {
|
||||
}
|
||||
|
||||
pub fn visibility_of(self, db: &dyn HirDatabase, def: &ModuleDef) -> Option<Visibility> {
|
||||
self.id.def_map(db.upcast())[self.id.local_id].scope.visibility_of(def.clone().into())
|
||||
self.id.def_map(db.upcast())[self.id.local_id].scope.visibility_of((*def).into())
|
||||
}
|
||||
|
||||
pub fn diagnostics(
|
||||
|
@ -606,7 +606,7 @@ pub struct DocsRangeMap {
|
||||
impl DocsRangeMap {
|
||||
pub fn map(&self, range: TextRange) -> Option<InFile<TextRange>> {
|
||||
let found = self.mapping.binary_search_by(|(probe, ..)| probe.ordering(range)).ok()?;
|
||||
let (line_docs_range, idx, original_line_src_range) = self.mapping[found].clone();
|
||||
let (line_docs_range, idx, original_line_src_range) = self.mapping[found];
|
||||
if !line_docs_range.contains_range(range) {
|
||||
return None;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ pub struct ItemScope {
|
||||
pub(crate) static BUILTIN_SCOPE: Lazy<FxHashMap<Name, PerNs>> = Lazy::new(|| {
|
||||
BuiltinType::ALL
|
||||
.iter()
|
||||
.map(|(name, ty)| (name.clone(), PerNs::types(ty.clone().into(), Visibility::Public)))
|
||||
.map(|(name, ty)| (name.clone(), PerNs::types((*ty).into(), Visibility::Public)))
|
||||
.collect()
|
||||
});
|
||||
|
||||
|
@ -45,7 +45,6 @@ impl ProcMacroExpander {
|
||||
let proc_macro = krate_graph[self.krate]
|
||||
.proc_macro
|
||||
.get(id.0 as usize)
|
||||
.clone()
|
||||
.ok_or_else(|| err!("No derive macro found."))?;
|
||||
|
||||
// Proc macros have access to the environment variables of the invoking crate.
|
||||
|
@ -43,7 +43,7 @@ pub(crate) fn goto_definition(
|
||||
let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?;
|
||||
let (_, link, ns) =
|
||||
extract_definitions_from_markdown(docs.as_str()).into_iter().find(|(range, ..)| {
|
||||
doc_mapping.map(range.clone()).map_or(false, |InFile { file_id, value: range }| {
|
||||
doc_mapping.map(*range).map_or(false, |InFile { file_id, value: range }| {
|
||||
file_id == position.file_id.into() && range.contains(position.offset)
|
||||
})
|
||||
})?;
|
||||
|
@ -87,7 +87,7 @@ fn impls_for_trait_item(
|
||||
.filter_map(|imp| {
|
||||
let item = imp.items(sema.db).iter().find_map(|itm| {
|
||||
let itm_name = itm.name(sema.db)?;
|
||||
(itm_name == fun_name).then(|| itm.clone())
|
||||
(itm_name == fun_name).then(|| *itm)
|
||||
})?;
|
||||
item.try_to_nav(sema.db)
|
||||
})
|
||||
|
@ -131,7 +131,7 @@ pub(crate) fn hover(
|
||||
let (docs, doc_mapping) = attributes.docs_with_rangemap(db)?;
|
||||
let (idl_range, link, ns) =
|
||||
extract_definitions_from_markdown(docs.as_str()).into_iter().find_map(|(range, link, ns)| {
|
||||
let InFile { file_id, value: range } = doc_mapping.map(range.clone())?;
|
||||
let InFile { file_id, value: range } = doc_mapping.map(range)?;
|
||||
if file_id == position.file_id.into() && range.contains(position.offset) {
|
||||
Some((range, link, ns))
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user