From 4ad9e986ad05e404df73701c098b71f73a847ca6 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Thu, 4 Jul 2019 13:26:44 -0400 Subject: Some clippy fixes for 1.36 --- crates/ra_hir/src/ty/infer.rs | 14 ++++++-------- crates/ra_hir/src/ty/infer/unify.rs | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'crates/ra_hir/src/ty') diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index a2dc92370..9228dd314 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs @@ -116,16 +116,16 @@ pub struct InferenceResult { impl InferenceResult { pub fn method_resolution(&self, expr: ExprId) -> Option { - self.method_resolutions.get(&expr).map(|it| *it) + self.method_resolutions.get(&expr).copied() } pub fn field_resolution(&self, expr: ExprId) -> Option { - self.field_resolutions.get(&expr).map(|it| *it) + self.field_resolutions.get(&expr).copied() } pub fn assoc_resolutions_for_expr(&self, id: ExprId) -> Option { - self.assoc_resolutions.get(&id.into()).map(|it| *it) + self.assoc_resolutions.get(&id.into()).copied() } pub fn assoc_resolutions_for_pat(&self, id: PatId) -> Option { - self.assoc_resolutions.get(&id.into()).map(|it| *it) + self.assoc_resolutions.get(&id.into()).copied() } pub(crate) fn add_diagnostics( &self, @@ -239,8 +239,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { &self.resolver, type_ref, ); - let ty = self.insert_type_vars(ty); - ty + self.insert_type_vars(ty) } fn unify_substs(&mut self, substs1: &Substs, substs2: &Substs, depth: usize) -> bool { @@ -973,8 +972,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { for (arg_pat, arg_type) in args.iter().zip(arg_types.iter()) { let expected = if let Some(type_ref) = arg_type { - let ty = self.make_ty(type_ref); - ty + self.make_ty(type_ref) } else { Ty::Unknown }; diff --git a/crates/ra_hir/src/ty/infer/unify.rs b/crates/ra_hir/src/ty/infer/unify.rs index 04633bdb2..49bf5b946 100644 --- a/crates/ra_hir/src/ty/infer/unify.rs +++ b/crates/ra_hir/src/ty/infer/unify.rs @@ -102,7 +102,7 @@ impl Canonicalized { ty.fold(&mut |ty| match ty { Ty::Bound(idx) => { if (idx as usize) < self.free_vars.len() { - Ty::Infer(self.free_vars[idx as usize].clone()) + Ty::Infer(self.free_vars[idx as usize]) } else { Ty::Bound(idx) } @@ -120,7 +120,7 @@ impl Canonicalized { let new_vars = (0..solution.num_vars).map(|_| ctx.new_type_var()).collect::>().into(); for (i, ty) in solution.value.into_iter().enumerate() { - let var = self.free_vars[i].clone(); + let var = self.free_vars[i]; ctx.unify(&Ty::Infer(var), &ty.subst_bound_vars(&new_vars)); } } -- cgit v1.2.3