2023-10-15 00:57:33 +02:00
|
|
|
#![warn(clippy::unnecessary_fallible_conversions)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let _: i64 = 0i32.try_into().unwrap();
|
|
|
|
let _: i64 = 0i32.try_into().expect("can't happen");
|
2024-01-01 16:17:46 +08:00
|
|
|
|
|
|
|
let _ = i64::try_from(0i32).unwrap();
|
|
|
|
let _ = i64::try_from(0i32).expect("can't happen");
|
|
|
|
|
|
|
|
let _: i64 = i32::try_into(0).unwrap();
|
|
|
|
let _: i64 = i32::try_into(0i32).expect("can't happen");
|
|
|
|
|
2024-01-01 16:28:34 +08:00
|
|
|
let _ = <i64 as TryFrom<i32>>::try_from(0).unwrap();
|
|
|
|
let _ = <i64 as TryFrom<i32>>::try_from(0).expect("can't happen");
|
2024-01-01 16:17:46 +08:00
|
|
|
|
|
|
|
let _: i64 = <i32 as TryInto<_>>::try_into(0).unwrap();
|
|
|
|
let _: i64 = <i32 as TryInto<_>>::try_into(0).expect("can't happen");
|
2023-10-15 00:57:33 +02:00
|
|
|
}
|