@@ -2,19 +2,137 @@ error: use of a fallible conversion when an infallible one could be used
22 --> $DIR/unnecessary_fallible_conversions.rs:4:23
33 |
44LL | let _: i64 = 0i32.try_into().unwrap();
5- | ^^^^^^^^^^^^^^^^^^^ help: use: `into()`
5+ | ^^^^^^^^^^^^^^^^^^^
66 |
77 = note: converting `i32` to `i64` cannot fail
88 = note: `-D clippy::unnecessary-fallible-conversions` implied by `-D warnings`
99 = help: to override `-D warnings` add `#[allow(clippy::unnecessary_fallible_conversions)]`
10+ help: use
11+ |
12+ LL - let _: i64 = 0i32.try_into().unwrap();
13+ LL + let _: i64 = 0i32.into();
14+ |
1015
1116error: use of a fallible conversion when an infallible one could be used
1217 --> $DIR/unnecessary_fallible_conversions.rs:5:23
1318 |
1419LL | let _: i64 = 0i32.try_into().expect("can't happen");
15- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `into()`
20+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+ |
22+ = note: converting `i32` to `i64` cannot fail
23+ help: use
24+ |
25+ LL - let _: i64 = 0i32.try_into().expect("can't happen");
26+ LL + let _: i64 = 0i32.into();
27+ |
28+
29+ error: use of a fallible conversion when an infallible one could be used
30+ --> $DIR/unnecessary_fallible_conversions.rs:7:13
31+ |
32+ LL | let _ = i64::try_from(0i32).unwrap();
33+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34+ |
35+ = note: converting `i32` to `i64` cannot fail
36+ help: use
37+ |
38+ LL - let _ = i64::try_from(0i32).unwrap();
39+ LL + let _ = i64::from(0i32);
40+ |
41+
42+ error: use of a fallible conversion when an infallible one could be used
43+ --> $DIR/unnecessary_fallible_conversions.rs:8:13
44+ |
45+ LL | let _ = i64::try_from(0i32).expect("can't happen");
46+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47+ |
48+ = note: converting `i32` to `i64` cannot fail
49+ help: use
50+ |
51+ LL - let _ = i64::try_from(0i32).expect("can't happen");
52+ LL + let _ = i64::from(0i32);
53+ |
54+
55+ error: use of a fallible conversion when an infallible one could be used
56+ --> $DIR/unnecessary_fallible_conversions.rs:10:18
57+ |
58+ LL | let _: i64 = i32::try_into(0).unwrap();
59+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
60+ |
61+ = note: converting `i32` to `i64` cannot fail
62+ help: use
63+ |
64+ LL - let _: i64 = i32::try_into(0).unwrap();
65+ LL + let _: i64 = i32::into(0);
66+ |
67+
68+ error: use of a fallible conversion when an infallible one could be used
69+ --> $DIR/unnecessary_fallible_conversions.rs:11:18
70+ |
71+ LL | let _: i64 = i32::try_into(0i32).expect("can't happen");
72+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1673 |
1774 = note: converting `i32` to `i64` cannot fail
75+ help: use
76+ |
77+ LL - let _: i64 = i32::try_into(0i32).expect("can't happen");
78+ LL + let _: i64 = i32::into(0i32);
79+ |
80+
81+ error: use of a fallible conversion when an infallible one could be used
82+ --> $DIR/unnecessary_fallible_conversions.rs:13:13
83+ |
84+ LL | let _ = <i64 as TryFrom<i32>>::try_from(0)
85+ | _____________^
86+ LL | | .unwrap();
87+ | |_________________^
88+ |
89+ = note: converting `i32` to `i64` cannot fail
90+ help: use
91+ |
92+ LL - let _ = <i64 as TryFrom<i32>>::try_from(0)
93+ LL + let _ = <i64 as From<i32>>::from(0);
94+ |
95+
96+ error: use of a fallible conversion when an infallible one could be used
97+ --> $DIR/unnecessary_fallible_conversions.rs:15:13
98+ |
99+ LL | let _ = <i64 as TryFrom<i32>>::try_from(0).
100+ | _____________^
101+ LL | | expect("can't happen");
102+ | |______________________________^
103+ |
104+ = note: converting `i32` to `i64` cannot fail
105+ help: use
106+ |
107+ LL - let _ = <i64 as TryFrom<i32>>::try_from(0).
108+ LL + let _ = <i64 as From<i32>>::from(0);
109+ |
110+
111+ error: use of a fallible conversion when an infallible one could be used
112+ --> $DIR/unnecessary_fallible_conversions.rs:18:18
113+ |
114+ LL | let _: i64 = <i32 as TryInto<_>>::try_into(0).unwrap();
115+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
116+ |
117+ = note: converting `i32` to `i64` cannot fail
118+ help: use
119+ |
120+ LL - let _: i64 = <i32 as TryInto<_>>::try_into(0).unwrap();
121+ LL + let _: i64 = <i32 as Into<_>>::into(0);
122+ |
123+
124+ error: use of a fallible conversion when an infallible one could be used
125+ --> $DIR/unnecessary_fallible_conversions.rs:19:18
126+ |
127+ LL | let _: i64 = <i32 as TryInto<_>>::try_into(0).expect("can't happen");
128+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129+ |
130+ = note: converting `i32` to `i64` cannot fail
131+ help: use
132+ |
133+ LL - let _: i64 = <i32 as TryInto<_>>::try_into(0).expect("can't happen");
134+ LL + let _: i64 = <i32 as Into<_>>::into(0);
135+ |
18136
19- error: aborting due to 2 previous errors
137+ error: aborting due to 10 previous errors
20138
0 commit comments