X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=tests%2Fui%2Fchecked_conversions.fixed;h=e279ba3147bba3420159b3cccb6a0bc5181efda0;hb=26df55112f754033d18d2157731ae3b4ecd41aa8;hp=12290db3dcf52adb00bbb3232d74234be2ab06fc;hpb=6fc99398932b176ac99fd2a76ef8a9aa975a2797;p=rust.git diff --git a/tests/ui/checked_conversions.fixed b/tests/ui/checked_conversions.fixed index 12290db3dcf..e279ba3147b 100644 --- a/tests/ui/checked_conversions.fixed +++ b/tests/ui/checked_conversions.fixed @@ -2,13 +2,12 @@ #![allow( clippy::cast_lossless, + unused, // Int::max_value will be deprecated in the future deprecated, )] #![warn(clippy::checked_conversions)] -use std::convert::TryFrom; - // Positive tests // Signed to unsigned @@ -73,4 +72,21 @@ pub fn i8_to_u8(value: i8) { let _ = value >= 0; } +// Do not lint +pub const fn issue_8898(i: u32) -> bool { + i <= i32::MAX as u32 +} + +#[clippy::msrv = "1.33"] +fn msrv_1_33() { + let value: i64 = 33; + let _ = value <= (u32::MAX as i64) && value >= 0; +} + +#[clippy::msrv = "1.34"] +fn msrv_1_34() { + let value: i64 = 34; + let _ = u32::try_from(value).is_ok(); +} + fn main() {}