mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
Split a lint message into help
This commit is contained in:
parent
73ffae6ea1
commit
306f9e843d
2 changed files with 5 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg};
|
||||
use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_sugg};
|
||||
use clippy_utils::higher::FormatArgsExpn;
|
||||
use clippy_utils::{is_expn_of, match_function_call, paths};
|
||||
use if_chain::if_chain;
|
||||
|
@ -97,8 +97,8 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitWrite {
|
|||
);
|
||||
} else {
|
||||
// We don't have a proper suggestion
|
||||
let msg = format!("{}. Consider using `{}{}!` instead", msg, prefix, sugg_mac);
|
||||
span_lint(cx, EXPLICIT_WRITE, expr.span, &msg);
|
||||
let help = format!("consider using `{}{}!` instead", prefix, sugg_mac);
|
||||
span_lint_and_help(cx, EXPLICIT_WRITE, expr.span, &msg, None, &help);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
error: use of `writeln!(stderr(), ...).unwrap()`. Consider using `eprintln!` instead
|
||||
error: use of `writeln!(stderr(), ...).unwrap()`
|
||||
--> $DIR/explicit_write_non_rustfix.rs:7:5
|
||||
|
|
||||
LL | writeln!(std::io::stderr(), "foo {}", bar).unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::explicit-write` implied by `-D warnings`
|
||||
= help: consider using `eprintln!` instead
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
Loading…
Reference in a new issue