]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/checked_conversions.fixed
Fix adjacent code
[rust.git] / tests / ui / checked_conversions.fixed
index 12290db3dcf52adb00bbb3232d74234be2ab06fc..e279ba3147bba3420159b3cccb6a0bc5181efda0 100644 (file)
@@ -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() {}