1
- //! Checks for useless borrowed references in clojures .
1
+ //! Checks for useless borrowed references.
2
2
//!
3
3
//! This lint is **warn** by default
4
4
@@ -7,9 +7,9 @@ use rustc::hir::{MutImmutable, Pat, PatKind, BindingMode};
7
7
use rustc:: ty;
8
8
use utils:: { span_lint, in_macro} ;
9
9
10
- /// **What it does:** Checks for useless borrowed references in clojures .
10
+ /// **What it does:** Checks for useless borrowed references.
11
11
///
12
- /// **Why is this bad?** TODO
12
+ /// **Why is this bad?** It is completely useless and make the code look more complex than it actually is.
13
13
///
14
14
/// **Known problems:** None.
15
15
///
@@ -18,7 +18,8 @@ use utils::{span_lint, in_macro};
18
18
/// let mut v = Vec::<String>::new();
19
19
/// let _ = v.iter_mut().filter(|&ref a| a.is_empty());
20
20
/// ```
21
- /// It could just be |a| a.is_empty()
21
+ /// This clojure takes a reference on something that has been matched as a reference and de-referenced.
22
+ /// As such, it could just be |a| a.is_empty()
22
23
declare_lint ! {
23
24
pub NEEDLESS_BORROWED_REFERENCE ,
24
25
Warn ,
@@ -50,7 +51,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrowedRef {
50
51
// This is an immutable reference.
51
52
tam. mutbl == MutImmutable ,
52
53
] , {
53
- span_lint( cx, NEEDLESS_BORROWED_REFERENCE , pat. span, "this pattern takes a needless borrowed reference " )
54
+ span_lint( cx, NEEDLESS_BORROWED_REFERENCE , pat. span, "this pattern takes a reference on something that is being de-referenced " )
54
55
} }
55
56
}
56
57
}
0 commit comments