Skip to content

Commit 306f9e8

Browse files
committed
Split a lint message into help
1 parent 73ffae6 commit 306f9e8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

clippy_lints/src/explicit_write.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use clippy_utils::diagnostics::{span_lint, span_lint_and_sugg};
1+
use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_sugg};
22
use clippy_utils::higher::FormatArgsExpn;
33
use clippy_utils::{is_expn_of, match_function_call, paths};
44
use if_chain::if_chain;
@@ -97,8 +97,8 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitWrite {
9797
);
9898
} else {
9999
// We don't have a proper suggestion
100-
let msg = format!("{}. Consider using `{}{}!` instead", msg, prefix, sugg_mac);
101-
span_lint(cx, EXPLICIT_WRITE, expr.span, &msg);
100+
let help = format!("consider using `{}{}!` instead", prefix, sugg_mac);
101+
span_lint_and_help(cx, EXPLICIT_WRITE, expr.span, &msg, None, &help);
102102
}
103103
}
104104
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
error: use of `writeln!(stderr(), ...).unwrap()`. Consider using `eprintln!` instead
1+
error: use of `writeln!(stderr(), ...).unwrap()`
22
--> $DIR/explicit_write_non_rustfix.rs:7:5
33
|
44
LL | writeln!(std::io::stderr(), "foo {}", bar).unwrap();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::explicit-write` implied by `-D warnings`
8+
= help: consider using `eprintln!` instead
89

910
error: aborting due to previous error
1011

0 commit comments

Comments
 (0)