Improve needless_borrowed_ref lint comments.

This commit is contained in:
Benoît CORTIER 2017-06-29 13:45:54 +02:00 committed by Oliver Schneider
parent 0063309a00
commit 2460454155
No known key found for this signature in database
GPG key ID: A69F8D225B3AD7D9

View file

@ -48,11 +48,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrowedRef {
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")