]> git.lizzy.rs Git - rust.git/commitdiff
dogfood error in consts fixed
authorAndre Bogus <bogusandre@gmail.com>
Tue, 31 May 2016 18:14:59 +0000 (20:14 +0200)
committermcarton <cartonmartin+git@gmail.com>
Tue, 31 May 2016 21:30:49 +0000 (23:30 +0200)
clippy_lints/src/consts.rs

index 96956d1793b6fafcde17dd1b6ed4e9633d9693fc..b4c8521a0a9fa8accc1ebbdd5aa4b066d5191da7 100644 (file)
@@ -345,8 +345,8 @@ fn binop(&mut self, op: BinOp, left: &Expr, right: &Expr) -> Option<Constant> {
             (BiDiv, Constant::Int(l), Some(Constant::Int(r))) => (l / r).ok().map(Constant::Int),
             (BiRem, Constant::Int(l), Some(Constant::Int(r))) => (l % r).ok().map(Constant::Int),
             (BiAnd, Constant::Bool(false), _) => Some(Constant::Bool(false)),
-            (BiAnd, Constant::Bool(true), Some(r)) => Some(r),
             (BiOr, Constant::Bool(true), _) => Some(Constant::Bool(true)),
+            (BiAnd, Constant::Bool(true), Some(r)) |
             (BiOr, Constant::Bool(false), Some(r)) => Some(r),
             (BiBitXor, Constant::Bool(l), Some(Constant::Bool(r))) => Some(Constant::Bool(l ^ r)),
             (BiBitXor, Constant::Int(l), Some(Constant::Int(r))) => (l ^ r).ok().map(Constant::Int),