mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-21 18:43:20 +00:00
73 lines
2.9 KiB
Text
73 lines
2.9 KiB
Text
error: calling `.parse()` without trimming the trailing newline character
|
|
--> $DIR/read_line_without_trim.rs:14:25
|
|
|
|
|
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
|
|
--> $DIR/read_line_without_trim.rs:13:5
|
|
|
|
|
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
|
|
--> $DIR/read_line_without_trim.rs:18:20
|
|
|
|
|
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
|
|
--> $DIR/read_line_without_trim.rs:17:5
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: calling `.parse()` without trimming the trailing newline character
|
|
--> $DIR/read_line_without_trim.rs:22: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
|
|
--> $DIR/read_line_without_trim.rs:21:5
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: calling `.parse()` without trimming the trailing newline character
|
|
--> $DIR/read_line_without_trim.rs:26: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
|
|
--> $DIR/read_line_without_trim.rs:25:5
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: calling `.parse()` without trimming the trailing newline character
|
|
--> $DIR/read_line_without_trim.rs:30: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
|
|
--> $DIR/read_line_without_trim.rs:29:5
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 5 previous errors
|
|
|