]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/excessive_precision.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / excessive_precision.rs
index c17639aaf04a0960fb0d7df9253f41c53576fc74..59b252a3a80a9b013d0bb19396fa9adcf4871573 100644 (file)
@@ -1,6 +1,14 @@
+// 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(excessive_precision)]
-#![allow(print_literal)]
+#![warn(clippy::excessive_precision)]
+#![allow(clippy::print_literal)]
 
 fn main() {
     // Consts
@@ -22,7 +30,7 @@ fn main() {
     const BAD64_3: f64 = 0.100_000_000_000_000_000_1;
 
     // Literal as param
-    println!("{}", 8.888_888_888_888_888_888_888);
+    println!("{:?}", 8.888_888_888_888_888_888_888);
 
     // // TODO add inferred type tests for f32
     // Locals
@@ -54,4 +62,10 @@ fn main() {
 
     let good_bige32: f32 = 1E-10;
     let bad_bige32: f32 = 1.123_456_788_888E-10;
+
+    // Inferred type
+    let good_inferred: f32 = 1f32 * 1_000_000_000.;
+
+    // issue #2840
+    let num = 0.000_000_000_01e-10f64;
 }