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 environment = db.trait_environment(self.func.into());
Type {
krate,
env: environment.clone(),
ty: ctx.lower_ty(&db.function_data(self.func).params[0].1),
}
Type { krate, env: environment, ty: ctx.lower_ty(&db.function_data(self.func).params[0].1) }
}
}

View file

@ -52,7 +52,7 @@ impl DefMap {
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(

View file

@ -82,7 +82,7 @@ pub(crate) fn normalize(db: &dyn HirDatabase, owner: DefWithBodyId, ty: Ty) -> T
let trait_env = owner
.as_generic_def_id()
.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);
table.resolve_obligations_as_possible();

View file

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

View file

@ -306,7 +306,7 @@ impl NameClass {
if let Some(it) = ast::LifetimeParam::cast(parent.clone()) {
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)
} else {
None