]> git.lizzy.rs Git - rust.git/commitdiff
Improve needless_borrowed_ref lint comments.
authorBenoît CORTIER <benoit.cortier@fried-world.eu>
Thu, 29 Jun 2017 11:45:54 +0000 (13:45 +0200)
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Mon, 21 Aug 2017 12:00:29 +0000 (14:00 +0200)
clippy_lints/src/needless_borrowed_ref.rs

index 6f81c8114149638ae883a624d98cdb81454a2d1d..0167b171297150a7a3b835a85846e3477e52f029 100644 (file)
@@ -48,11 +48,11 @@ fn check_pat(&mut self, cx: &LateContext<'a, 'tcx>, pat: &'tcx Pat) {
 
         if_let_chain! {[
             // Pat is a pattern whose node
-            // is a binding which "involves" a immutable reference...
+            // is a binding which "involves" an immutable reference...
             let PatKind::Binding(BindingAnnotation::Ref, ..) = pat.node,
             // Pattern's type is a reference. Get the type and mutability of referenced value (tam: TypeAndMut).
             let ty::TyRef(_, ref tam) = cx.tables.pat_ty(pat).sty,
-            // This is an immutable reference.
+            // Only lint immutable refs, because `&mut ref T` may be useful.
             tam.mutbl == MutImmutable,
         ], {
             span_lint(cx, NEEDLESS_BORROWED_REFERENCE, pat.span, "this pattern takes a reference on something that is being de-referenced")