Improve warning
This commit is contained in:
parent
c5ff54cbdb
commit
217c88655b
3 changed files with 18 additions and 16 deletions
|
@ -70,11 +70,13 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
|
|||
.iter()
|
||||
.any(|s| cx.tcx.is_diagnostic_item(*s, i.def_id()))
|
||||
{
|
||||
let span = expr.span;
|
||||
let expr_span = expr.span;
|
||||
|
||||
cx.struct_span_lint(NOOP_METHOD_CALL, span, |lint| {
|
||||
let message = "call to noop method";
|
||||
lint.build(&message).emit()
|
||||
cx.struct_span_lint(NOOP_METHOD_CALL, expr_span, |lint| {
|
||||
let message = "call to method that does nothing";
|
||||
lint.build(&message)
|
||||
.span_label(expr_span, "unnecessary method call")
|
||||
.emit()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue