mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
better messages
This commit is contained in:
parent
1f8453ab73
commit
b9414637e2
1 changed files with 3 additions and 3 deletions
|
@ -26,13 +26,13 @@ impl LintPass for MutMut {
|
||||||
unwrap_addr(expr).map(|e| {
|
unwrap_addr(expr).map(|e| {
|
||||||
if unwrap_addr(e).is_some() {
|
if unwrap_addr(e).is_some() {
|
||||||
cx.span_lint(MUT_MUT, expr.span,
|
cx.span_lint(MUT_MUT, expr.span,
|
||||||
"We're not sure what this means, so if you know, please tell us.")
|
"Generally you want to avoid &mut &mut _ if possible.")
|
||||||
} else {
|
} else {
|
||||||
match expr_ty(cx.tcx, e).sty {
|
match expr_ty(cx.tcx, e).sty {
|
||||||
ty_ptr(mt{ty: _, mutbl: MutMutable}) |
|
ty_ptr(mt{ty: _, mutbl: MutMutable}) |
|
||||||
ty_rptr(_, mt{ty: _, mutbl: MutMutable}) =>
|
ty_rptr(_, mt{ty: _, mutbl: MutMutable}) =>
|
||||||
cx.span_lint(MUT_MUT, expr.span,
|
cx.span_lint(MUT_MUT, expr.span,
|
||||||
"This expression mutably borrows a mutable reference. Consider direct reborrowing"),
|
"This expression mutably borrows a mutable reference. Consider reborrowing"),
|
||||||
_ => ()
|
_ => ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ impl LintPass for MutMut {
|
||||||
fn check_ty(&mut self, cx: &Context, ty: &Ty) {
|
fn check_ty(&mut self, cx: &Context, ty: &Ty) {
|
||||||
if unwrap_mut(ty).and_then(unwrap_mut).is_some() {
|
if unwrap_mut(ty).and_then(unwrap_mut).is_some() {
|
||||||
cx.span_lint(MUT_MUT, ty.span,
|
cx.span_lint(MUT_MUT, ty.span,
|
||||||
"We're not sure what this means, so if you know, please tell us.")
|
"Generally you want to avoid &mut &mut _ if possible.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue