about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/cast_lossless_integer.fixed
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-22 15:22:49 +0000
committerbors <bors@rust-lang.org>2024-03-22 15:22:49 +0000
commit2fae357cb87d6ec184a34892394d4e737ecd6030 (patch)
tree2e95d58c16c36d9159307f386ce1912c94bc4fff /src/tools/clippy/tests/ui/cast_lossless_integer.fixed
parentf61f45f2336ad473ca152252f81e447ae19e0553 (diff)
parentee57d2b318fc17080740172896269cd9865a17f4 (diff)
Auto merge of #3394 - RalfJung:rustup, r=RalfJung
Rustup
Diffstat (limited to 'src/tools/clippy/tests/ui/cast_lossless_integer.fixed')
-rw-r--r--src/tools/clippy/tests/ui/cast_lossless_integer.fixed10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/cast_lossless_integer.fixed b/src/tools/clippy/tests/ui/cast_lossless_integer.fixed
index 5e7e545e764..291556a9774 100644
--- a/src/tools/clippy/tests/ui/cast_lossless_integer.fixed
+++ b/src/tools/clippy/tests/ui/cast_lossless_integer.fixed
@@ -1,6 +1,9 @@
 #![allow(clippy::no_effect, clippy::unnecessary_operation, dead_code)]
 #![warn(clippy::cast_lossless)]
 
+type I64 = i64;
+type U128 = u128;
+
 fn main() {
     // Test clippy::cast_lossless with casts to integer types
     let _ = i16::from(1i8);
@@ -24,6 +27,13 @@ fn main() {
 
     // Test with an expression wrapped in parens
     let _ = u16::from(1u8 + 1u8);
+
+    let _ = I64::from(1i8);
+
+    // Do not lint if destination type is u128
+    // see https://github.com/rust-lang/rust-clippy/issues/12492
+    let _ = 1u8 as u128;
+    let _ = 1u8 as U128;
 }
 
 // The lint would suggest using `f64::from(input)` here but the `XX::from` function is not const,