From cd114880800069d5a79c5bfb5c146110b078160c Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 25 Sep 2015 18:52:36 +0530 Subject: [PATCH] rustup 2015-09-24 --- Cargo.toml | 2 +- src/consts.rs | 2 +- src/shadow.rs | 12 +++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8a905ffac42..5ff911c8ced 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clippy" -version = "0.0.16" +version = "0.0.17" authors = [ "Manish Goregaokar ", "Andre Bogus ", diff --git a/src/consts.rs b/src/consts.rs index d66bfb5b4fc..be681efb257 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -321,7 +321,7 @@ fn expr(&mut self, e: &Expr) -> Option { |o| match op { UnNot => constant_not(o), UnNeg => constant_negate(o), - UnUniq | UnDeref => Some(o), + UnDeref => Some(o), }), ExprBinary(op, ref left, ref right) => self.binop(op, left, right), diff --git a/src/shadow.rs b/src/shadow.rs index 25970df399d..8fd8d0d15ac 100644 --- a/src/shadow.rs +++ b/src/shadow.rs @@ -140,7 +140,7 @@ fn check_pat(cx: &LateContext, pat: &Pat, init: &Option<&Expr>, span: Span, }, PatBox(ref inner) => { if let Some(ref initp) = *init { - if let ExprBox(_, ref inner_init) = initp.node { + if let ExprBox(ref inner_init) = initp.node { check_pat(cx, inner, &Some(&**inner_init), span, bindings); } else { check_pat(cx, inner, init, span, bindings); @@ -198,10 +198,8 @@ fn check_expr(cx: &LateContext, expr: &Expr, bindings: &mut Vec<(Name, Span)>) { if in_external_macro(cx, expr.span) { return; } match expr.node { ExprUnary(_, ref e) | ExprField(ref e, _) | - ExprTupField(ref e, _) | ExprAddrOf(_, ref e) | ExprBox(None, ref e) + ExprTupField(ref e, _) | ExprAddrOf(_, ref e) | ExprBox(ref e) => { check_expr(cx, e, bindings) }, - ExprBox(Some(ref place), ref e) => { - check_expr(cx, place, bindings); check_expr(cx, e, bindings) } ExprBlock(ref block) | ExprLoop(ref block, _) => { check_block(cx, block, bindings) }, //ExprCall @@ -254,11 +252,11 @@ fn check_ty(cx: &LateContext, ty: &Ty, bindings: &mut Vec<(Name, Span)>) { fn is_self_shadow(name: Name, expr: &Expr) -> bool { match expr.node { - ExprBox(_, ref inner) | + ExprBox(ref inner) | ExprAddrOf(_, ref inner) => is_self_shadow(name, inner), ExprBlock(ref block) => block.stmts.is_empty() && block.expr.as_ref(). map_or(false, |ref e| is_self_shadow(name, e)), - ExprUnary(op, ref inner) => (UnUniq == op || UnDeref == op) && + ExprUnary(op, ref inner) => (UnDeref == op) && is_self_shadow(name, inner), ExprPath(_, ref path) => path_eq_name(name, path), _ => false, @@ -278,7 +276,7 @@ fn contains_self(name: Name, expr: &Expr) -> bool { ExprLit(_) => false, // one subexpr ExprUnary(_, ref e) | ExprField(ref e, _) | - ExprTupField(ref e, _) | ExprAddrOf(_, ref e) | ExprBox(_, ref e) | + ExprTupField(ref e, _) | ExprAddrOf(_, ref e) | ExprBox(ref e) | ExprCast(ref e, _) => contains_self(name, e), // two subexprs -- 2.44.0