rust-clippy/tests/ui/read_line_without_trim.stderr

74 lines
2.9 KiB
Text
Raw Normal View History

2023-06-16 23:41:11 +00:00
error: calling `.parse()` without trimming the trailing newline character
2023-07-27 11:40:22 +00:00
--> $DIR/read_line_without_trim.rs:12:25
2023-06-16 23:41:11 +00:00
|
LL | let _x: i32 = input.parse().unwrap();
| ----- ^^^^^^^
| |
| help: try: `input.trim_end()`
|
note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause `.parse()` to fail
2023-07-27 11:40:22 +00:00
--> $DIR/read_line_without_trim.rs:11:5
2023-06-16 23:41:11 +00:00
|
LL | std::io::stdin().read_line(&mut input).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: `-D clippy::read-line-without-trim` implied by `-D warnings`
error: calling `.parse()` without trimming the trailing newline character
2023-07-27 11:40:22 +00:00
--> $DIR/read_line_without_trim.rs:16:20
2023-06-16 23:41:11 +00:00
|
LL | let _x = input.parse::<i32>().unwrap();
| ----- ^^^^^^^^^^^^^^
| |
| help: try: `input.trim_end()`
|
note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause `.parse()` to fail
2023-07-27 11:40:22 +00:00
--> $DIR/read_line_without_trim.rs:15:5
2023-06-16 23:41:11 +00:00
|
LL | std::io::stdin().read_line(&mut input).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: calling `.parse()` without trimming the trailing newline character
2023-07-27 11:40:22 +00:00
--> $DIR/read_line_without_trim.rs:20:20
|
LL | let _x = input.parse::<u32>().unwrap();
| ----- ^^^^^^^^^^^^^^
| |
| help: try: `input.trim_end()`
|
note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause `.parse()` to fail
2023-07-27 11:40:22 +00:00
--> $DIR/read_line_without_trim.rs:19:5
|
LL | std::io::stdin().read_line(&mut input).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: calling `.parse()` without trimming the trailing newline character
2023-07-27 11:40:22 +00:00
--> $DIR/read_line_without_trim.rs:24:20
|
LL | let _x = input.parse::<f32>().unwrap();
| ----- ^^^^^^^^^^^^^^
| |
| help: try: `input.trim_end()`
|
note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause `.parse()` to fail
2023-07-27 11:40:22 +00:00
--> $DIR/read_line_without_trim.rs:23:5
|
LL | std::io::stdin().read_line(&mut input).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: calling `.parse()` without trimming the trailing newline character
2023-07-27 11:40:22 +00:00
--> $DIR/read_line_without_trim.rs:28:20
|
LL | let _x = input.parse::<bool>().unwrap();
| ----- ^^^^^^^^^^^^^^^
| |
| help: try: `input.trim_end()`
|
note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause `.parse()` to fail
2023-07-27 11:40:22 +00:00
--> $DIR/read_line_without_trim.rs:27:5
|
LL | std::io::stdin().read_line(&mut input).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 5 previous errors
2023-06-16 23:41:11 +00:00