2023-07-10 18:06:27 +00:00
|
|
|
error: calling `.parse()` on a string without trimming the trailing newline character
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/read_line_without_trim.rs:12:25
|
2023-07-17 08:19:29 +00:00
|
|
|
|
|
|
|
|
LL | let _x: i32 = input.parse().unwrap();
|
|
|
|
| ----- ^^^^^^^
|
|
|
|
| |
|
|
|
|
| help: try: `input.trim_end()`
|
|
|
|
|
|
2023-07-10 18:06:27 +00:00
|
|
|
note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/read_line_without_trim.rs:11:5
|
2023-07-17 08:19:29 +00:00
|
|
|
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
= note: `-D clippy::read-line-without-trim` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::read_line_without_trim)]`
|
2023-07-17 08:19:29 +00:00
|
|
|
|
2023-07-10 18:06:27 +00:00
|
|
|
error: calling `.parse()` on a string without trimming the trailing newline character
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/read_line_without_trim.rs:16:20
|
2023-07-17 08:19:29 +00:00
|
|
|
|
|
|
|
|
LL | let _x = input.parse::<i32>().unwrap();
|
|
|
|
| ----- ^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| help: try: `input.trim_end()`
|
|
|
|
|
|
2023-07-10 18:06:27 +00:00
|
|
|
note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/read_line_without_trim.rs:15:5
|
2023-07-17 08:19:29 +00:00
|
|
|
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2023-07-10 18:06:27 +00:00
|
|
|
error: calling `.parse()` on a string without trimming the trailing newline character
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/read_line_without_trim.rs:20:20
|
2023-07-17 08:19:29 +00:00
|
|
|
|
|
|
|
|
LL | let _x = input.parse::<u32>().unwrap();
|
|
|
|
| ----- ^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| help: try: `input.trim_end()`
|
|
|
|
|
|
2023-07-10 18:06:27 +00:00
|
|
|
note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/read_line_without_trim.rs:19:5
|
2023-07-17 08:19:29 +00:00
|
|
|
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2023-07-10 18:06:27 +00:00
|
|
|
error: calling `.parse()` on a string without trimming the trailing newline character
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/read_line_without_trim.rs:24:20
|
2023-07-17 08:19:29 +00:00
|
|
|
|
|
|
|
|
LL | let _x = input.parse::<f32>().unwrap();
|
|
|
|
| ----- ^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| help: try: `input.trim_end()`
|
|
|
|
|
|
2023-07-10 18:06:27 +00:00
|
|
|
note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/read_line_without_trim.rs:23:5
|
2023-07-17 08:19:29 +00:00
|
|
|
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2023-07-10 18:06:27 +00:00
|
|
|
error: calling `.parse()` on a string without trimming the trailing newline character
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/read_line_without_trim.rs:28:20
|
2023-07-17 08:19:29 +00:00
|
|
|
|
|
|
|
|
LL | let _x = input.parse::<bool>().unwrap();
|
|
|
|
| ----- ^^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| help: try: `input.trim_end()`
|
|
|
|
|
|
2023-07-10 18:06:27 +00:00
|
|
|
note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause the checking to always fail
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/read_line_without_trim.rs:27:5
|
2023-07-17 08:19:29 +00:00
|
|
|
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2023-07-10 18:06:27 +00:00
|
|
|
error: comparing a string literal without trimming the trailing newline character
|
|
|
|
--> tests/ui/read_line_without_trim.rs:38:8
|
|
|
|
|
|
|
|
|
LL | if input == "foo" {
|
|
|
|
| -----^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| 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 the comparison to always fail
|
|
|
|
--> tests/ui/read_line_without_trim.rs:37:5
|
|
|
|
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: checking the end of a string without trimming the trailing newline character
|
|
|
|
--> tests/ui/read_line_without_trim.rs:44:8
|
|
|
|
|
|
|
|
|
LL | if input.ends_with("foo") {
|
|
|
|
| -----^^^^^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| 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 the parsing to always fail
|
|
|
|
--> tests/ui/read_line_without_trim.rs:43:5
|
|
|
|
|
|
|
|
|
LL | std::io::stdin().read_line(&mut input).unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: aborting due to 7 previous errors
|
2023-07-17 08:19:29 +00:00
|
|
|
|