Skip to content

Commit e9964e7

Browse files
committed
Improve needless_borrowed_ref lint doc.
1 parent 1cae336 commit e9964e7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

clippy_lints/src/needless_borrowed_ref.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Checks for useless borrowed references in clojures.
1+
//! Checks for useless borrowed references.
22
//!
33
//! This lint is **warn** by default
44
@@ -7,9 +7,9 @@ use rustc::hir::{MutImmutable, Pat, PatKind, BindingMode};
77
use rustc::ty;
88
use utils::{span_lint, in_macro};
99

10-
/// **What it does:** Checks for useless borrowed references in clojures.
10+
/// **What it does:** Checks for useless borrowed references.
1111
///
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.
1313
///
1414
/// **Known problems:** None.
1515
///
@@ -18,7 +18,8 @@ use utils::{span_lint, in_macro};
1818
/// let mut v = Vec::<String>::new();
1919
/// let _ = v.iter_mut().filter(|&ref a| a.is_empty());
2020
/// ```
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()
2223
declare_lint! {
2324
pub NEEDLESS_BORROWED_REFERENCE,
2425
Warn,
@@ -50,7 +51,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrowedRef {
5051
// This is an immutable reference.
5152
tam.mutbl == MutImmutable,
5253
], {
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")
5455
}}
5556
}
5657
}

0 commit comments

Comments
 (0)