From c9b4ac5be4daaabc062ab1ee663eba8594750003 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:24:16 +0530 Subject: clippy::redudant_borrow --- crates/hir_ty/src/infer/coerce.rs | 2 +- crates/hir_ty/src/infer/expr.rs | 12 ++++++------ crates/hir_ty/src/infer/pat.rs | 2 +- crates/hir_ty/src/infer/path.rs | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'crates/hir_ty/src/infer') diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index 03b97e7db..8647d7437 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs @@ -109,7 +109,7 @@ impl<'a> InferenceContext<'a> { } // Consider coercing the subtype to a DST - if let Ok(ret) = self.try_coerce_unsized(&from_ty, &to_ty) { + if let Ok(ret) = self.try_coerce_unsized(&from_ty, to_ty) { return Ok(ret); } diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index e34f194ff..4805c0a00 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs @@ -54,7 +54,7 @@ impl<'a> InferenceContext<'a> { /// Infer type of expression with possibly implicit coerce to the expected type. /// Return the type after possible coercion. pub(super) fn infer_expr_coerce(&mut self, expr: ExprId, expected: &Expectation) -> Ty { - let ty = self.infer_expr_inner(expr, &expected); + let ty = self.infer_expr_inner(expr, expected); let ty = if let Some(target) = expected.only_has_type(&mut self.table) { if !self.coerce(&ty, &target) { self.result @@ -135,11 +135,11 @@ impl<'a> InferenceContext<'a> { let mut both_arms_diverge = Diverges::Always; let mut result_ty = self.table.new_type_var(); - let then_ty = self.infer_expr_inner(*then_branch, &expected); + let then_ty = self.infer_expr_inner(*then_branch, expected); both_arms_diverge &= mem::replace(&mut self.diverges, Diverges::Maybe); result_ty = self.coerce_merge_branch(Some(*then_branch), &result_ty, &then_ty); let else_ty = match else_branch { - Some(else_branch) => self.infer_expr_inner(*else_branch, &expected), + Some(else_branch) => self.infer_expr_inner(*else_branch, expected), None => TyBuilder::unit(), }; both_arms_diverge &= self.diverges; @@ -330,8 +330,8 @@ impl<'a> InferenceContext<'a> { .infer_method_call( tgt_expr, *receiver, - &args, - &method_name, + args, + method_name, generic_args.as_deref(), ), Expr::Match { expr, arms } => { @@ -993,7 +993,7 @@ impl<'a> InferenceContext<'a> { } fn register_obligations_for_call(&mut self, callable_ty: &Ty) { - let callable_ty = self.resolve_ty_shallow(&callable_ty); + let callable_ty = self.resolve_ty_shallow(callable_ty); if let TyKind::FnDef(fn_def, parameters) = callable_ty.kind(&Interner) { let def: CallableDefId = from_chalk(self.db, *fn_def); let generic_predicates = self.db.generic_predicates(def.into()); diff --git a/crates/hir_ty/src/infer/pat.rs b/crates/hir_ty/src/infer/pat.rs index 25dff7e49..8f5db1f40 100644 --- a/crates/hir_ty/src/infer/pat.rs +++ b/crates/hir_ty/src/infer/pat.rs @@ -192,7 +192,7 @@ impl<'a> InferenceContext<'a> { Pat::Path(path) => { // FIXME use correct resolver for the surrounding expression let resolver = self.resolver.clone(); - self.infer_path(&resolver, &path, pat.into()).unwrap_or(self.err_ty()) + self.infer_path(&resolver, path, pat.into()).unwrap_or(self.err_ty()) } Pat::Bind { mode, name: _, subpat } => { let mode = if mode == &BindingAnnotation::Unannotated { diff --git a/crates/hir_ty/src/infer/path.rs b/crates/hir_ty/src/infer/path.rs index 14c99eafd..056cdb5d5 100644 --- a/crates/hir_ty/src/infer/path.rs +++ b/crates/hir_ty/src/infer/path.rs @@ -43,11 +43,11 @@ impl<'a> InferenceContext<'a> { } let ty = self.make_ty(type_ref); let remaining_segments_for_ty = path.segments().take(path.segments().len() - 1); - let ctx = crate::lower::TyLoweringContext::new(self.db, &resolver); + let ctx = crate::lower::TyLoweringContext::new(self.db, resolver); let (ty, _) = ctx.lower_ty_relative_path(ty, None, remaining_segments_for_ty); self.resolve_ty_assoc_item( ty, - &path.segments().last().expect("path had at least one segment").name, + path.segments().last().expect("path had at least one segment").name, id, )? } else { @@ -154,7 +154,7 @@ impl<'a> InferenceContext<'a> { let segment = remaining_segments.last().expect("there should be at least one segment here"); - self.resolve_ty_assoc_item(ty, &segment.name, id) + self.resolve_ty_assoc_item(ty, segment.name, id) } } } -- cgit v1.2.3