Change lint name
From `suggest_print` to `explicit_write`
This commit is contained in:
parent
a46bf3f456
commit
aeeb38dab1
@ -542,7 +542,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
||||
serde_api::SERDE_API_MISUSE,
|
||||
should_assert_eq::SHOULD_ASSERT_EQ,
|
||||
strings::STRING_LIT_AS_BYTES,
|
||||
suggest_print::SUGGEST_PRINT,
|
||||
suggest_print::EXPLICIT_WRITE,
|
||||
swap::ALMOST_SWAPPED,
|
||||
swap::MANUAL_SWAP,
|
||||
temporary_assignment::TEMPORARY_ASSIGNMENT,
|
||||
|
@ -16,7 +16,7 @@ use utils::opt_def_id;
|
||||
/// writeln!(&mut io::stderr(), "foo: {:?}", bar).unwrap();
|
||||
/// ```
|
||||
declare_lint! {
|
||||
pub SUGGEST_PRINT,
|
||||
pub EXPLICIT_WRITE,
|
||||
Warn,
|
||||
"using `write!()` family of functions instead of `print!()` family of \
|
||||
functions, when using the latter would work"
|
||||
@ -27,7 +27,7 @@ pub struct Pass;
|
||||
|
||||
impl LintPass for Pass {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(SUGGEST_PRINT)
|
||||
lint_array!(EXPLICIT_WRITE)
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
||||
if let Some(macro_name) = calling_macro {
|
||||
span_lint(
|
||||
cx,
|
||||
SUGGEST_PRINT,
|
||||
EXPLICIT_WRITE,
|
||||
expr.span,
|
||||
&format!(
|
||||
"use of `{}!({}(), ...).unwrap()`. Consider using `{}{}!` instead",
|
||||
@ -87,7 +87,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
||||
} else {
|
||||
span_lint(
|
||||
cx,
|
||||
SUGGEST_PRINT,
|
||||
EXPLICIT_WRITE,
|
||||
expr.span,
|
||||
&format!(
|
||||
"use of `{}().write_fmt(...).unwrap()`. Consider using `{}print!` instead",
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![warn(suggest_print)]
|
||||
#![warn(explicit_write)]
|
||||
|
||||
|
||||
fn stdout() -> String {
|
||||
|
@ -4,7 +4,7 @@ error: use of `write!(stdout(), ...).unwrap()`. Consider using `print!` instead
|
||||
16 | write!(std::io::stdout(), "test").unwrap();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D suggest-print` implied by `-D warnings`
|
||||
= note: `-D explicit-write` implied by `-D warnings`
|
||||
|
||||
error: use of `write!(stderr(), ...).unwrap()`. Consider using `eprint!` instead
|
||||
--> $DIR/suggest_print.rs:17:9
|
||||
|
Loading…
x
Reference in New Issue
Block a user