]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/identity_op.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / identity_op.rs
index 1ed9f974d436c2b4c0f3e863755b137e41a80229..299cd2a67863ba58562e65687bf2726a33d9e93a 100644 (file)
@@ -1,12 +1,24 @@
-
-
-
-const ONE : i64 = 1;
-const NEG_ONE : i64 = -1;
-const ZERO : i64 = 0;
-
-#[allow(eq_op, no_effect, unnecessary_operation, double_parens)]
-#[warn(identity_op)]
+// 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.
+
+const ONE: i64 = 1;
+const NEG_ONE: i64 = -1;
+const ZERO: i64 = 0;
+
+#[allow(
+    clippy::eq_op,
+    clippy::no_effect,
+    clippy::unnecessary_operation,
+    clippy::double_parens
+)]
+#[warn(clippy::identity_op)]
+#[rustfmt::skip]
 fn main() {
     let x = 0;
 
@@ -15,19 +27,19 @@ fn main() {
     x + 1;
     0 + x;
     1 + x;
-    x - ZERO;     //no error, as we skip lookups (for now)
+    x - ZERO; //no error, as we skip lookups (for now)
     x | (0);
     ((ZERO)) | x; //no error, as we skip lookups (for now)
 
     x * 1;
     1 * x;
-    x / ONE;      //no error, as we skip lookups (for now)
+    x / ONE; //no error, as we skip lookups (for now)
 
-    x / 2;        //no false positive
+    x / 2; //no false positive
 
-    x & NEG_ONE;  //no error, as we skip lookups (for now)
+    x & NEG_ONE; //no error, as we skip lookups (for now)
     -1 & x;
 
-    let u : u8 = 0;
+    let u: u8 = 0;
     u & 255;
 }