@@ -27,5 +27,47 @@ 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::<f32>().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: calling `.parse()` without trimming the trailing newline character
59+ --> $DIR/read_line_without_trim.rs:30:20
60+ |
61+ LL | let _x = input.parse::<bool>().unwrap();
62+ | ----- ^^^^^^^^^^^^^^^
63+ | |
64+ | help: try: `input.trim_end()`
65+ |
66+ note: call to `.read_line()` here, which leaves a trailing newline character in the buffer, which in turn will cause `.parse()` to fail
67+ --> $DIR/read_line_without_trim.rs:29:5
68+ |
69+ LL | std::io::stdin().read_line(&mut input).unwrap();
70+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71+
72+ error: aborting due to 5 previous errors
3173
0 commit comments