mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 01:42:54 +03:00
675fd681aa
Make `writeln_empty_string` don't provide an auto-fix suggestion when there is a comment in the macro call span.
27 lines
545 B
Rust
27 lines
545 B
Rust
#![allow(unused_must_use)]
|
|
#![warn(clippy::writeln_empty_string)]
|
|
|
|
use std::io::Write;
|
|
|
|
// If there is a comment in the span of macro call, we don't provide an auto-fix suggestion.
|
|
#[rustfmt::skip]
|
|
fn issue_16251() {
|
|
let mut v = Vec::new();
|
|
|
|
writeln!(v, /* comment */ "");
|
|
//~^ writeln_empty_string
|
|
|
|
writeln!(v, "" /* comment */);
|
|
//~^ writeln_empty_string
|
|
|
|
//~v writeln_empty_string
|
|
writeln!(v,
|
|
"\
|
|
\
|
|
"
|
|
|
|
// there is a comment in the macro span regardless of its position
|
|
|
|
);
|
|
}
|