mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 17:53:56 +00:00
rustup 2015-09-24
This commit is contained in:
parent
294d7d8586
commit
cd11488080
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "clippy"
|
name = "clippy"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
authors = [
|
authors = [
|
||||||
"Manish Goregaokar <manishsmail@gmail.com>",
|
"Manish Goregaokar <manishsmail@gmail.com>",
|
||||||
"Andre Bogus <bogusandre@gmail.com>",
|
"Andre Bogus <bogusandre@gmail.com>",
|
||||||
|
@ -321,7 +321,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
|
|||||||
|o| match op {
|
|o| match op {
|
||||||
UnNot => constant_not(o),
|
UnNot => constant_not(o),
|
||||||
UnNeg => constant_negate(o),
|
UnNeg => constant_negate(o),
|
||||||
UnUniq | UnDeref => Some(o),
|
UnDeref => Some(o),
|
||||||
}),
|
}),
|
||||||
ExprBinary(op, ref left, ref right) =>
|
ExprBinary(op, ref left, ref right) =>
|
||||||
self.binop(op, left, right),
|
self.binop(op, left, right),
|
||||||
|
@ -140,7 +140,7 @@ fn check_pat(cx: &LateContext, pat: &Pat, init: &Option<&Expr>, span: Span,
|
|||||||
},
|
},
|
||||||
PatBox(ref inner) => {
|
PatBox(ref inner) => {
|
||||||
if let Some(ref initp) = *init {
|
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);
|
check_pat(cx, inner, &Some(&**inner_init), span, bindings);
|
||||||
} else {
|
} else {
|
||||||
check_pat(cx, inner, init, span, bindings);
|
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; }
|
if in_external_macro(cx, expr.span) { return; }
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ExprUnary(_, ref e) | ExprField(ref e, _) |
|
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) },
|
=> { 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, _) =>
|
ExprBlock(ref block) | ExprLoop(ref block, _) =>
|
||||||
{ check_block(cx, block, bindings) },
|
{ check_block(cx, block, bindings) },
|
||||||
//ExprCall
|
//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 {
|
fn is_self_shadow(name: Name, expr: &Expr) -> bool {
|
||||||
match expr.node {
|
match expr.node {
|
||||||
ExprBox(_, ref inner) |
|
ExprBox(ref inner) |
|
||||||
ExprAddrOf(_, ref inner) => is_self_shadow(name, inner),
|
ExprAddrOf(_, ref inner) => is_self_shadow(name, inner),
|
||||||
ExprBlock(ref block) => block.stmts.is_empty() && block.expr.as_ref().
|
ExprBlock(ref block) => block.stmts.is_empty() && block.expr.as_ref().
|
||||||
map_or(false, |ref e| is_self_shadow(name, e)),
|
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),
|
is_self_shadow(name, inner),
|
||||||
ExprPath(_, ref path) => path_eq_name(name, path),
|
ExprPath(_, ref path) => path_eq_name(name, path),
|
||||||
_ => false,
|
_ => false,
|
||||||
@ -278,7 +276,7 @@ fn contains_self(name: Name, expr: &Expr) -> bool {
|
|||||||
ExprLit(_) => false,
|
ExprLit(_) => false,
|
||||||
// one subexpr
|
// one subexpr
|
||||||
ExprUnary(_, ref e) | ExprField(ref e, _) |
|
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, _) =>
|
ExprCast(ref e, _) =>
|
||||||
contains_self(name, e),
|
contains_self(name, e),
|
||||||
// two subexprs
|
// two subexprs
|
||||||
|
Loading…
Reference in New Issue
Block a user