Allow print/write with multiple newlines
This commit is contained in:
parent
77025557f9
commit
550ff84ecd
5 changed files with 26 additions and 21 deletions
|
|
@ -6,7 +6,7 @@
|
|||
fn main() {
|
||||
print!("Hello\n");
|
||||
print!("Hello {}\n", "world");
|
||||
print!("Hello {} {}\n\n", "world", "#2");
|
||||
print!("Hello {} {}\n", "world", "#2");
|
||||
print!("{}\n", 1265);
|
||||
|
||||
// these are all fine
|
||||
|
|
@ -18,4 +18,7 @@ fn main() {
|
|||
print!("Issue\n{}", 1265);
|
||||
print!("{}", 1265);
|
||||
print!("\n{}", 1275);
|
||||
print!("\n\n");
|
||||
print!("like eof\n\n");
|
||||
print!("Hello {} {}\n\n", "world", "#2");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead
|
||||
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
||||
--> $DIR/print_with_newline.rs:7:5
|
||||
|
|
||||
7 | print!("Hello/n");
|
||||
|
|
@ -6,19 +6,19 @@ error: using `print!()` with a format string that ends in a newline, consider us
|
|||
|
|
||||
= note: `-D print-with-newline` implied by `-D warnings`
|
||||
|
||||
error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead
|
||||
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
||||
--> $DIR/print_with_newline.rs:8:5
|
||||
|
|
||||
8 | print!("Hello {}/n", "world");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead
|
||||
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
||||
--> $DIR/print_with_newline.rs:9:5
|
||||
|
|
||||
9 | print!("Hello {} {}/n/n", "world", "#2");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
9 | print!("Hello {} {}/n", "world", "#2");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: using `print!()` with a format string that ends in a newline, consider using `println!()` instead
|
||||
error: using `print!()` with a format string that ends in a single newline, consider using `println!()` instead
|
||||
--> $DIR/print_with_newline.rs:10:5
|
||||
|
|
||||
10 | print!("{}/n", 1265);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ fn main() {
|
|||
// These should fail
|
||||
write!(&mut v, "Hello\n");
|
||||
write!(&mut v, "Hello {}\n", "world");
|
||||
write!(&mut v, "Hello {} {}\n\n", "world", "#2");
|
||||
write!(&mut v, "Hello {} {}\n", "world", "#2");
|
||||
write!(&mut v, "{}\n", 1265);
|
||||
|
||||
// These should be fine
|
||||
|
|
@ -21,5 +21,7 @@ fn main() {
|
|||
write!(&mut v, "Issue\n{}", 1265);
|
||||
write!(&mut v, "{}", 1265);
|
||||
write!(&mut v, "\n{}", 1275);
|
||||
|
||||
write!(&mut v, "\n\n");
|
||||
write!(&mut v, "like eof\n\n");
|
||||
write!(&mut v, "Hello {} {}\n\n", "world", "#2");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error: using `write!()` with a format string that ends in a newline, consider using `writeln!()` instead
|
||||
error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
|
||||
--> $DIR/write_with_newline.rs:10:5
|
||||
|
|
||||
10 | write!(&mut v, "Hello/n");
|
||||
|
|
@ -6,19 +6,19 @@ error: using `write!()` with a format string that ends in a newline, consider us
|
|||
|
|
||||
= note: `-D write-with-newline` implied by `-D warnings`
|
||||
|
||||
error: using `write!()` with a format string that ends in a newline, consider using `writeln!()` instead
|
||||
error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
|
||||
--> $DIR/write_with_newline.rs:11:5
|
||||
|
|
||||
11 | write!(&mut v, "Hello {}/n", "world");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: using `write!()` with a format string that ends in a newline, consider using `writeln!()` instead
|
||||
error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
|
||||
--> $DIR/write_with_newline.rs:12:5
|
||||
|
|
||||
12 | write!(&mut v, "Hello {} {}/n/n", "world", "#2");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
12 | write!(&mut v, "Hello {} {}/n", "world", "#2");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: using `write!()` with a format string that ends in a newline, consider using `writeln!()` instead
|
||||
error: using `write!()` with a format string that ends in a single newline, consider using `writeln!()` instead
|
||||
--> $DIR/write_with_newline.rs:13:5
|
||||
|
|
||||
13 | write!(&mut v, "{}/n", 1265);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue