]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/cast_size.rs
iterate List by value
[rust.git] / tests / ui / cast_size.rs
index fddf9669a8f70f4893a4ae5e36adc627f2017ace..595109be46bb878f3ce9b4e94c0223c4fb7c72f1 100644 (file)
@@ -1,24 +1,21 @@
-// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-
-
-#[warn(clippy::cast_precision_loss, clippy::cast_possible_truncation, clippy::cast_sign_loss, clippy::cast_possible_wrap, clippy::cast_lossless)]
+// ignore-32bit
+#[warn(
+    clippy::cast_precision_loss,
+    clippy::cast_possible_truncation,
+    clippy::cast_sign_loss,
+    clippy::cast_possible_wrap,
+    clippy::cast_lossless
+)]
 #[allow(clippy::no_effect, clippy::unnecessary_operation)]
 fn main() {
     // Casting from *size
     1isize as i8;
-    1isize as f64;
-    1usize as f64;
-    1isize as f32;
-    1usize as f32;
+    let x0 = 1isize;
+    let x1 = 1usize;
+    x0 as f64;
+    x1 as f64;
+    x0 as f32;
+    x1 as f32;
     1isize as i32;
     1isize as u32;
     1usize as u32;
@@ -32,4 +29,7 @@ fn main() {
     1u32 as usize; // Should not trigger any lint
     1i32 as isize; // Neither should this
     1i32 as usize;
+    // Big integer literal to float
+    999_999_999 as f32;
+    9_999_999_999_999_999usize as f64;
 }