mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
138 lines
4.4 KiB
Text
138 lines
4.4 KiB
Text
error: use of a fallible conversion when an infallible one could be used
|
|
--> $DIR/unnecessary_fallible_conversions.rs:4:23
|
|
|
|
|
LL | let _: i64 = 0i32.try_into().unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: converting `i32` to `i64` cannot fail
|
|
= note: `-D clippy::unnecessary-fallible-conversions` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_fallible_conversions)]`
|
|
help: use
|
|
|
|
|
LL - let _: i64 = 0i32.try_into().unwrap();
|
|
LL + let _: i64 = 0i32.into();
|
|
|
|
|
|
|
error: use of a fallible conversion when an infallible one could be used
|
|
--> $DIR/unnecessary_fallible_conversions.rs:5:23
|
|
|
|
|
LL | let _: i64 = 0i32.try_into().expect("can't happen");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: converting `i32` to `i64` cannot fail
|
|
help: use
|
|
|
|
|
LL - let _: i64 = 0i32.try_into().expect("can't happen");
|
|
LL + let _: i64 = 0i32.into();
|
|
|
|
|
|
|
error: use of a fallible conversion when an infallible one could be used
|
|
--> $DIR/unnecessary_fallible_conversions.rs:7:13
|
|
|
|
|
LL | let _ = i64::try_from(0i32).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: converting `i32` to `i64` cannot fail
|
|
help: use
|
|
|
|
|
LL - let _ = i64::try_from(0i32).unwrap();
|
|
LL + let _ = i64::from(0i32);
|
|
|
|
|
|
|
error: use of a fallible conversion when an infallible one could be used
|
|
--> $DIR/unnecessary_fallible_conversions.rs:8:13
|
|
|
|
|
LL | let _ = i64::try_from(0i32).expect("can't happen");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: converting `i32` to `i64` cannot fail
|
|
help: use
|
|
|
|
|
LL - let _ = i64::try_from(0i32).expect("can't happen");
|
|
LL + let _ = i64::from(0i32);
|
|
|
|
|
|
|
error: use of a fallible conversion when an infallible one could be used
|
|
--> $DIR/unnecessary_fallible_conversions.rs:10:18
|
|
|
|
|
LL | let _: i64 = i32::try_into(0).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: converting `i32` to `i64` cannot fail
|
|
help: use
|
|
|
|
|
LL - let _: i64 = i32::try_into(0).unwrap();
|
|
LL + let _: i64 = i32::into(0);
|
|
|
|
|
|
|
error: use of a fallible conversion when an infallible one could be used
|
|
--> $DIR/unnecessary_fallible_conversions.rs:11:18
|
|
|
|
|
LL | let _: i64 = i32::try_into(0i32).expect("can't happen");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: converting `i32` to `i64` cannot fail
|
|
help: use
|
|
|
|
|
LL - let _: i64 = i32::try_into(0i32).expect("can't happen");
|
|
LL + let _: i64 = i32::into(0i32);
|
|
|
|
|
|
|
error: use of a fallible conversion when an infallible one could be used
|
|
--> $DIR/unnecessary_fallible_conversions.rs:13:13
|
|
|
|
|
LL | let _ = <i64 as TryFrom<i32>>::try_from(0)
|
|
| _____________^
|
|
LL | | .unwrap();
|
|
| |_________________^
|
|
|
|
|
= note: converting `i32` to `i64` cannot fail
|
|
help: use
|
|
|
|
|
LL - let _ = <i64 as TryFrom<i32>>::try_from(0)
|
|
LL + let _ = <i64 as From<i32>>::from(0);
|
|
|
|
|
|
|
error: use of a fallible conversion when an infallible one could be used
|
|
--> $DIR/unnecessary_fallible_conversions.rs:15:13
|
|
|
|
|
LL | let _ = <i64 as TryFrom<i32>>::try_from(0).
|
|
| _____________^
|
|
LL | | expect("can't happen");
|
|
| |______________________________^
|
|
|
|
|
= note: converting `i32` to `i64` cannot fail
|
|
help: use
|
|
|
|
|
LL - let _ = <i64 as TryFrom<i32>>::try_from(0).
|
|
LL + let _ = <i64 as From<i32>>::from(0);
|
|
|
|
|
|
|
error: use of a fallible conversion when an infallible one could be used
|
|
--> $DIR/unnecessary_fallible_conversions.rs:18:18
|
|
|
|
|
LL | let _: i64 = <i32 as TryInto<_>>::try_into(0).unwrap();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: converting `i32` to `i64` cannot fail
|
|
help: use
|
|
|
|
|
LL - let _: i64 = <i32 as TryInto<_>>::try_into(0).unwrap();
|
|
LL + let _: i64 = <i32 as Into<_>>::into(0);
|
|
|
|
|
|
|
error: use of a fallible conversion when an infallible one could be used
|
|
--> $DIR/unnecessary_fallible_conversions.rs:19:18
|
|
|
|
|
LL | let _: i64 = <i32 as TryInto<_>>::try_into(0).expect("can't happen");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: converting `i32` to `i64` cannot fail
|
|
help: use
|
|
|
|
|
LL - let _: i64 = <i32 as TryInto<_>>::try_into(0).expect("can't happen");
|
|
LL + let _: i64 = <i32 as Into<_>>::into(0);
|
|
|
|
|
|
|
error: aborting due to 10 previous errors
|
|
|