@@ -27,5 +27,33 @@ note: call to `.read_line()` here, which leaves a trailing newline character in
2727LL | std::io::stdin().read_line(&mut input).unwrap();
2828 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2929
30- error: aborting due to 2 previous errors
30+ error: calling `.parse()` without trimming the trailing newline character
31+ --> $DIR/read_line_without_trim.rs:22:20
32+ |
33+ LL | let _x = input.parse::<u32>().unwrap();
34+ | ----- ^^^^^^^^^^^^^^
35+ | |
36+ | help: try: `input.trim_end()`
37+ |
38+ note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause `.parse()` to fail
39+ --> $DIR/read_line_without_trim.rs:21:5
40+ |
41+ LL | std::io::stdin().read_line(&mut input).unwrap();
42+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43+
44+ error: calling `.parse()` without trimming the trailing newline character
45+ --> $DIR/read_line_without_trim.rs:26:20
46+ |
47+ LL | let _x = input.parse::<bool>().unwrap();
48+ | ----- ^^^^^^^^^^^^^^^
49+ | |
50+ | help: try: `input.trim_end()`
51+ |
52+ note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause `.parse()` to fail
53+ --> $DIR/read_line_without_trim.rs:25:5
54+ |
55+ LL | std::io::stdin().read_line(&mut input).unwrap();
56+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57+
58+ error: aborting due to 4 previous errors
3159
0 commit comments