1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
11 #[warn(clippy::eq_op)]
12 #[allow(clippy::identity_op, clippy::double_parens, clippy::many_single_char_names)]
13 #[allow(clippy::no_effect, unused_variables, clippy::unnecessary_operation, clippy::short_circuit_statement)]
14 #[warn(clippy::nonminimal_bool)]
16 // simple values and comparisons
19 // even though I agree that no means no ;-)
24 // casts, methods, parentheses
25 (1 as u64) & (1 as u64);
28 // unary and binary operators
30 ((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
31 (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4;
33 // various other things
36 vec![1, 2, 3] == vec![1, 2, 3]; //no error yet, as we don't match macros
59 2*a.len() == 2*a.len(); // ok, functions
60 a.pop() == a.pop(); // ok, functions
66 fn bitand(self, rhs: X) -> X {
70 impl<'a> BitAnd<&'a X> for X {
72 fn bitand(self, rhs: &'a X) -> X {
80 #[derive(Copy, Clone)]
84 fn bitand(self, rhs: Y) -> Y {
88 impl<'a> BitAnd<&'a Y> for Y {
90 fn bitand(self, rhs: &'a Y) -> Y {
103 const C: u32 = A / B; // ok, different named constants
104 const D: u32 = A / A;
108 macro_rules! check_if_named_foo {
109 ($expression:expr) => (
110 if stringify!($expression) == "foo" {
113 println!("not foo.");
118 fn check_ignore_macro() {
119 check_if_named_foo!(foo);