fix clippy::redundant_clone

This commit is contained in:
Matthias Krüger 2022-03-12 14:35:25 +01:00
parent d64d711db2
commit 21ffc5350d
5 changed files with 6 additions and 10 deletions

View file

@ -1530,11 +1530,7 @@ impl SelfParam {
let ctx = hir_ty::TyLoweringContext::new(db, &resolver); let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
let environment = db.trait_environment(self.func.into()); let environment = db.trait_environment(self.func.into());
Type { Type { krate, env: environment, ty: ctx.lower_ty(&db.function_data(self.func).params[0].1) }
krate,
env: environment.clone(),
ty: ctx.lower_ty(&db.function_data(self.func).params[0].1),
}
} }
} }

View file

@ -52,7 +52,7 @@ impl DefMap {
return Ok(ResolvedAttr::Other); return Ok(ResolvedAttr::Other);
} }
} }
None => return Err(UnresolvedMacro { path: ast_id.path.clone() }), None => return Err(UnresolvedMacro { path: ast_id.path }),
}; };
Ok(ResolvedAttr::Macro(attr_macro_as_call_id( Ok(ResolvedAttr::Macro(attr_macro_as_call_id(

View file

@ -82,7 +82,7 @@ pub(crate) fn normalize(db: &dyn HirDatabase, owner: DefWithBodyId, ty: Ty) -> T
let trait_env = owner let trait_env = owner
.as_generic_def_id() .as_generic_def_id()
.map_or_else(|| Arc::new(TraitEnvironment::empty(krate)), |d| db.trait_environment(d)); .map_or_else(|| Arc::new(TraitEnvironment::empty(krate)), |d| db.trait_environment(d));
let mut table = unify::InferenceTable::new(db, trait_env.clone()); let mut table = unify::InferenceTable::new(db, trait_env);
let ty_with_vars = table.normalize_associated_types_in(ty); let ty_with_vars = table.normalize_associated_types_in(ty);
table.resolve_obligations_as_possible(); table.resolve_obligations_as_possible();

View file

@ -663,7 +663,7 @@ pub fn iterate_method_candidates_dyn(
iterate_method_candidates_for_self_ty( iterate_method_candidates_for_self_ty(
ty, ty,
db, db,
env.clone(), env,
traits_in_scope, traits_in_scope,
visible_from_module, visible_from_module,
name, name,
@ -731,7 +731,7 @@ fn iterate_method_candidates_with_autoref(
first_adjustment.with_autoref(Mutability::Mut), first_adjustment.with_autoref(Mutability::Mut),
deref_chain, deref_chain,
db, db,
env.clone(), env,
traits_in_scope, traits_in_scope,
visible_from_module, visible_from_module,
name, name,

View file

@ -306,7 +306,7 @@ impl NameClass {
if let Some(it) = ast::LifetimeParam::cast(parent.clone()) { if let Some(it) = ast::LifetimeParam::cast(parent.clone()) {
sema.to_def(&it).map(Into::into).map(Definition::GenericParam) sema.to_def(&it).map(Into::into).map(Definition::GenericParam)
} else if let Some(it) = ast::Label::cast(parent.clone()) { } else if let Some(it) = ast::Label::cast(parent) {
sema.to_def(&it).map(Definition::Label) sema.to_def(&it).map(Definition::Label)
} else { } else {
None None