diff --git a/src/approx_const.rs b/src/approx_const.rs index 89cb5204a..9d1d51444 100644 --- a/src/approx_const.rs +++ b/src/approx_const.rs @@ -44,7 +44,7 @@ impl LintPass for ApproxConstant { impl LateLintPass for ApproxConstant { fn check_expr(&mut self, cx: &LateContext, e: &Expr) { - if let &ExprLit(ref lit) = &e.node { + if let ExprLit(ref lit) = e.node { check_lit(cx, lit, e); } } diff --git a/src/attrs.rs b/src/attrs.rs index a01016886..f4a5b4c15 100644 --- a/src/attrs.rs +++ b/src/attrs.rs @@ -42,7 +42,7 @@ impl LateLintPass for AttrPass { } fn is_relevant_item(item: &Item) -> bool { - if let &ItemFn(_, _, _, _, _, ref block) = &item.node { + if let ItemFn(_, _, _, _, _, ref block) = item.node { is_relevant_block(block) } else { false } } diff --git a/src/bit_mask.rs b/src/bit_mask.rs index c8530b92d..ab73086d0 100644 --- a/src/bit_mask.rs +++ b/src/bit_mask.rs @@ -182,7 +182,7 @@ fn check_ineffective_gt(cx: &LateContext, span: Span, m: u64, c: u64, op: &str) fn fetch_int_literal(cx: &LateContext, lit : &Expr) -> Option { match lit.node { ExprLit(ref lit_ptr) => { - if let &LitInt(value, _) = &lit_ptr.node { + if let LitInt(value, _) = lit_ptr.node { Option::Some(value) //TODO: Handle sign } else { Option::None } } diff --git a/src/len_zero.rs b/src/len_zero.rs index 25645ea87..9ac4ab1e0 100644 --- a/src/len_zero.rs +++ b/src/len_zero.rs @@ -125,7 +125,7 @@ fn check_len_zero(cx: &LateContext, span: Span, name: &Name, fn has_is_empty(cx: &LateContext, expr: &Expr) -> bool { /// get a ImplOrTraitItem and return true if it matches is_empty(self) fn is_is_empty(cx: &LateContext, id: &ImplOrTraitItemId) -> bool { - if let &MethodTraitItemId(def_id) = id { + if let MethodTraitItemId(def_id) = *id { if let ty::MethodTraitItem(ref method) = cx.tcx.impl_or_trait_item(def_id) { method.name.as_str() == "is_empty" diff --git a/src/lifetimes.rs b/src/lifetimes.rs index 9b47a4d83..acc7b0140 100644 --- a/src/lifetimes.rs +++ b/src/lifetimes.rs @@ -168,7 +168,7 @@ impl <'v, 't> RefVisitor<'v, 't> { } fn record(&mut self, lifetime: &Option) { - if let &Some(ref lt) = lifetime { + if let Some(ref lt) = *lifetime { if lt.name.as_str() == "'static" { self.lts.push(Static); } else { diff --git a/src/misc.rs b/src/misc.rs index 9a8ce74e9..9df751d49 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -84,10 +84,10 @@ impl LateLintPass for CmpNan { fn check_expr(&mut self, cx: &LateContext, expr: &Expr) { if let ExprBinary(ref cmp, ref left, ref right) = expr.node { if is_comparison_binop(cmp.node) { - if let &ExprPath(_, ref path) = &left.node { + if let ExprPath(_, ref path) = left.node { check_nan(cx, path, expr.span); } - if let &ExprPath(_, ref path) = &right.node { + if let ExprPath(_, ref path) = right.node { check_nan(cx, path, expr.span); } } @@ -189,7 +189,7 @@ fn check_to_owned(cx: &LateContext, expr: &Expr, other_span: Span, left: bool, o } } ExprCall(ref path, ref v) if v.len() == 1 => { - if let &ExprPath(None, ref path) = &path.node { + if let ExprPath(None, ref path) = path.node { if match_path(path, &["String", "from_str"]) || match_path(path, &["String", "from"]) { snippet(cx, v[0].span, "..") @@ -235,7 +235,7 @@ impl LintPass for ModuloOne { impl LateLintPass for ModuloOne { fn check_expr(&mut self, cx: &LateContext, expr: &Expr) { if let ExprBinary(ref cmp, _, ref right) = expr.node { - if let &Spanned {node: BinOp_::BiRem, ..} = cmp { + if let Spanned {node: BinOp_::BiRem, ..} = *cmp { if is_integer_literal(right, 1) { cx.span_lint(MODULO_ONE, expr.span, "any number modulo 1 will be 0"); } diff --git a/src/mutex_atomic.rs b/src/mutex_atomic.rs index 9c10a0624..e6d1fc8a8 100644 --- a/src/mutex_atomic.rs +++ b/src/mutex_atomic.rs @@ -34,7 +34,7 @@ pub struct MutexAtomic; impl LateLintPass for MutexAtomic { fn check_expr(&mut self, cx: &LateContext, expr: &Expr) { let ty = cx.tcx.expr_ty(expr); - if let &ty::TyStruct(_, subst) = &ty.sty { + if let ty::TyStruct(_, subst) = ty.sty { if match_type(cx, ty, &MUTEX_PATH) { let mutex_param = &subst.types.get(ParamSpace::TypeSpace, 0).sty; if let Some(atomic_name) = get_atomic_name(mutex_param) { diff --git a/src/ptr_arg.rs b/src/ptr_arg.rs index 78be2af12..6946d0549 100644 --- a/src/ptr_arg.rs +++ b/src/ptr_arg.rs @@ -28,13 +28,13 @@ impl LintPass for PtrArg { impl LateLintPass for PtrArg { fn check_item(&mut self, cx: &LateContext, item: &Item) { - if let &ItemFn(ref decl, _, _, _, _, _) = &item.node { + if let ItemFn(ref decl, _, _, _, _, _) = item.node { check_fn(cx, decl); } } fn check_impl_item(&mut self, cx: &LateContext, item: &ImplItem) { - if let &ImplItemKind::Method(ref sig, _) = &item.node { + if let ImplItemKind::Method(ref sig, _) = item.node { if let Some(Node::NodeItem(it)) = cx.tcx.map.find(cx.tcx.map.get_parent(item.id)) { if let ItemImpl(_, _, _, Some(_), _, _) = it.node { return; // ignore trait impls @@ -45,7 +45,7 @@ impl LateLintPass for PtrArg { } fn check_trait_item(&mut self, cx: &LateContext, item: &TraitItem) { - if let &MethodTraitItem(ref sig, _) = &item.node { + if let MethodTraitItem(ref sig, _) = item.node { check_fn(cx, &sig.decl); } } diff --git a/src/ranges.rs b/src/ranges.rs index 39ff7d3cd..31bb98523 100644 --- a/src/ranges.rs +++ b/src/ranges.rs @@ -40,10 +40,10 @@ impl LateLintPass for StepByZero { if_let_chain! { [ // .iter() call - let &ExprMethodCall( Spanned { node: ref iter_name, .. }, _, ref iter_args ) = iter, + let ExprMethodCall( Spanned { node: ref iter_name, .. }, _, ref iter_args ) = *iter, iter_name.as_str() == "iter", // range expression in .zip() call: 0..x.len() - let &ExprRange(Some(ref from), Some(ref to)) = zip_arg, + let ExprRange(Some(ref from), Some(ref to)) = *zip_arg, is_integer_literal(from, 0), // .len() call let ExprMethodCall(Spanned { node: ref len_name, .. }, _, ref len_args) = to.node, diff --git a/src/shadow.rs b/src/shadow.rs index 3f7272233..5fb27f75c 100644 --- a/src/shadow.rs +++ b/src/shadow.rs @@ -63,8 +63,8 @@ fn check_decl(cx: &LateContext, decl: &Decl, bindings: &mut Vec<(Name, Span)>) { if is_from_for_desugar(decl) { return; } if let DeclLocal(ref local) = decl.node { let Local{ ref pat, ref ty, ref init, id: _, span } = **local; - if let &Some(ref t) = ty { check_ty(cx, t, bindings) } - if let &Some(ref o) = init { + if let Some(ref t) = *ty { check_ty(cx, t, bindings) } + if let Some(ref o) = *init { check_expr(cx, o, bindings); check_pat(cx, pat, &Some(o), span, bindings); } else { @@ -210,7 +210,7 @@ fn check_expr(cx: &LateContext, expr: &Expr, bindings: &mut Vec<(Name, Span)>) { ExprIf(ref cond, ref then, ref otherwise) => { check_expr(cx, cond, bindings); check_block(cx, then, bindings); - if let &Some(ref o) = otherwise { check_expr(cx, o, bindings); } + if let Some(ref o) = *otherwise { check_expr(cx, o, bindings); } } ExprWhile(ref cond, ref block, _) => { check_expr(cx, cond, bindings); diff --git a/src/strings.rs b/src/strings.rs index 082746575..3c34e188d 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -34,14 +34,14 @@ impl LintPass for StringAdd { impl LateLintPass for StringAdd { fn check_expr(&mut self, cx: &LateContext, e: &Expr) { - if let &ExprBinary(Spanned{ node: BiAdd, .. }, ref left, _) = &e.node { + if let ExprBinary(Spanned{ node: BiAdd, .. }, ref left, _) = e.node { if is_string(cx, left) { if let Allow = cx.current_level(STRING_ADD_ASSIGN) { // the string_add_assign is allow, so no duplicates } else { let parent = get_parent_expr(cx, e); if let Some(ref p) = parent { - if let &ExprAssign(ref target, _) = &p.node { + if let ExprAssign(ref target, _) = p.node { // avoid duplicate matches if is_exp_equal(cx, target, left) { return; } } @@ -51,7 +51,7 @@ impl LateLintPass for StringAdd { "you added something to a string. \ Consider using `String::push_str()` instead") } - } else if let &ExprAssign(ref target, ref src) = &e.node { + } else if let ExprAssign(ref target, ref src) = e.node { if is_string(cx, target) && is_add(cx, src, target) { span_lint(cx, STRING_ADD_ASSIGN, e.span, "you assigned the result of adding something to this string. \