mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 13:13:34 +00:00
StmtKind
This commit is contained in:
parent
12ded030b6
commit
8cf463fe93
23 changed files with 66 additions and 66 deletions
|
@ -234,8 +234,8 @@ fn is_relevant_trait(tcx: TyCtxt, item: &TraitItem) -> bool {
|
|||
fn is_relevant_block(tcx: TyCtxt, tables: &ty::TypeckTables, block: &Block) -> bool {
|
||||
if let Some(stmt) = block.stmts.first() {
|
||||
match stmt.node {
|
||||
StmtDecl(_, _) => true,
|
||||
StmtExpr(ref expr, _) | StmtSemi(ref expr, _) => is_relevant_expr(tcx, tables, expr),
|
||||
StmtKind::Decl(_, _) => true,
|
||||
StmtKind::Expr(ref expr, _) | StmtKind::Semi(ref expr, _) => is_relevant_expr(tcx, tables, expr),
|
||||
}
|
||||
} else {
|
||||
block.expr.as_ref().map_or(false, |e| is_relevant_expr(tcx, tables, e))
|
||||
|
|
|
@ -110,7 +110,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
|
|||
if let Categorization::Rvalue(..) = cmt.cat {
|
||||
let id = map.hir_to_node_id(cmt.hir_id);
|
||||
if let Some(NodeStmt(st)) = map.find(map.get_parent_node(id)) {
|
||||
if let StmtDecl(ref decl, _) = st.node {
|
||||
if let StmtKind::Decl(ref decl, _) = st.node {
|
||||
if let DeclLocal(ref loc) = decl.node {
|
||||
if let Some(ref ex) = loc.init {
|
||||
if let ExprKind::Box(..) = ex.node {
|
||||
|
|
|
@ -82,8 +82,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EvalOrderDependence {
|
|||
}
|
||||
fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) {
|
||||
match stmt.node {
|
||||
StmtExpr(ref e, _) | StmtSemi(ref e, _) => DivergenceVisitor { cx }.maybe_walk_expr(e),
|
||||
StmtDecl(ref d, _) => if let DeclLocal(ref local) = d.node {
|
||||
StmtKind::Expr(ref e, _) | StmtKind::Semi(ref e, _) => DivergenceVisitor { cx }.maybe_walk_expr(e),
|
||||
StmtKind::Decl(ref d, _) => if let DeclLocal(ref local) = d.node {
|
||||
if let Local {
|
||||
init: Some(ref e), ..
|
||||
} = **local
|
||||
|
@ -262,8 +262,8 @@ fn check_expr<'a, 'tcx>(vis: &mut ReadVisitor<'a, 'tcx>, expr: &'tcx Expr) -> St
|
|||
|
||||
fn check_stmt<'a, 'tcx>(vis: &mut ReadVisitor<'a, 'tcx>, stmt: &'tcx Stmt) -> StopEarly {
|
||||
match stmt.node {
|
||||
StmtExpr(ref expr, _) | StmtSemi(ref expr, _) => check_expr(vis, expr),
|
||||
StmtDecl(ref decl, _) => {
|
||||
StmtKind::Expr(ref expr, _) | StmtKind::Semi(ref expr, _) => check_expr(vis, expr),
|
||||
StmtKind::Decl(ref decl, _) => {
|
||||
// If the declaration is of a local variable, check its initializer
|
||||
// expression if it has one. Otherwise, keep going.
|
||||
let local = match decl.node {
|
||||
|
|
|
@ -65,10 +65,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq {
|
|||
while let Some(stmt) = it.next() {
|
||||
if_chain! {
|
||||
if let Some(expr) = it.peek();
|
||||
if let hir::StmtDecl(ref decl, _) = stmt.node;
|
||||
if let hir::StmtKind::Decl(ref decl, _) = stmt.node;
|
||||
if let hir::DeclLocal(ref decl) = decl.node;
|
||||
if let hir::PatKind::Binding(mode, canonical_id, ident, None) = decl.pat.node;
|
||||
if let hir::StmtExpr(ref if_, _) = expr.node;
|
||||
if let hir::StmtKind::Expr(ref if_, _) = expr.node;
|
||||
if let hir::ExprKind::If(ref cond, ref then, ref else_) = if_.node;
|
||||
if !used_in_expr(cx, canonical_id, cond);
|
||||
if let hir::ExprKind::Block(ref then, _) = then.node;
|
||||
|
@ -163,7 +163,7 @@ fn check_assign<'a, 'tcx>(
|
|||
if_chain! {
|
||||
if block.expr.is_none();
|
||||
if let Some(expr) = block.stmts.iter().last();
|
||||
if let hir::StmtSemi(ref expr, _) = expr.node;
|
||||
if let hir::StmtKind::Semi(ref expr, _) = expr.node;
|
||||
if let hir::ExprKind::Assign(ref var, ref value) = expr.node;
|
||||
if let hir::ExprKind::Path(ref qpath) = var.node;
|
||||
if let Def::Local(local_id) = cx.tables.qpath_def(qpath, var.hir_id);
|
||||
|
|
|
@ -511,7 +511,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||
}
|
||||
|
||||
fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) {
|
||||
if let StmtSemi(ref expr, _) = stmt.node {
|
||||
if let StmtKind::Semi(ref expr, _) = stmt.node {
|
||||
if let ExprKind::MethodCall(ref method, _, ref args) = expr.node {
|
||||
if args.len() == 1 && method.ident.name == "collect" && match_trait_method(cx, expr, &paths::ITERATOR) {
|
||||
span_lint(
|
||||
|
@ -584,8 +584,8 @@ fn never_loop_block(block: &Block, main_loop_id: NodeId) -> NeverLoopResult {
|
|||
|
||||
fn stmt_to_expr(stmt: &Stmt) -> Option<&Expr> {
|
||||
match stmt.node {
|
||||
StmtSemi(ref e, ..) | StmtExpr(ref e, ..) => Some(e),
|
||||
StmtDecl(ref d, ..) => decl_to_expr(d),
|
||||
StmtKind::Semi(ref e, ..) | StmtKind::Expr(ref e, ..) => Some(e),
|
||||
StmtKind::Decl(ref d, ..) => decl_to_expr(d),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -859,8 +859,8 @@ fn get_indexed_assignments<'a, 'tcx>(
|
|||
stmts
|
||||
.iter()
|
||||
.map(|stmt| match stmt.node {
|
||||
Stmt_::StmtDecl(..) => None,
|
||||
Stmt_::StmtExpr(ref e, _node_id) | Stmt_::StmtSemi(ref e, _node_id) => Some(get_assignment(cx, e, var)),
|
||||
StmtKind::Decl(..) => None,
|
||||
StmtKind::Expr(ref e, _node_id) | StmtKind::Semi(ref e, _node_id) => Some(get_assignment(cx, e, var)),
|
||||
})
|
||||
.chain(
|
||||
expr.as_ref()
|
||||
|
@ -1809,7 +1809,7 @@ fn extract_expr_from_first_stmt(block: &Block) -> Option<&Expr> {
|
|||
if block.stmts.is_empty() {
|
||||
return None;
|
||||
}
|
||||
if let StmtDecl(ref decl, _) = block.stmts[0].node {
|
||||
if let StmtKind::Decl(ref decl, _) = block.stmts[0].node {
|
||||
if let DeclLocal(ref local) = decl.node {
|
||||
if let Some(ref expr) = local.init {
|
||||
Some(expr)
|
||||
|
@ -1829,8 +1829,8 @@ fn extract_first_expr(block: &Block) -> Option<&Expr> {
|
|||
match block.expr {
|
||||
Some(ref expr) if block.stmts.is_empty() => Some(expr),
|
||||
None if !block.stmts.is_empty() => match block.stmts[0].node {
|
||||
StmtExpr(ref expr, _) | StmtSemi(ref expr, _) => Some(expr),
|
||||
StmtDecl(..) => None,
|
||||
StmtKind::Expr(ref expr, _) | StmtKind::Semi(ref expr, _) => Some(expr),
|
||||
StmtKind::Decl(..) => None,
|
||||
},
|
||||
_ => None,
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc::hir;
|
||||
use rustc::lint::*;
|
||||
use rustc::ty;
|
||||
use rustc_errors::{Applicability};
|
||||
use rustc_errors::Applicability;
|
||||
use syntax::codemap::Span;
|
||||
use crate::utils::{in_macro, iter_input_pats, match_type, method_chain_args, snippet, span_lint_and_then};
|
||||
use crate::utils::paths;
|
||||
|
@ -131,9 +131,9 @@ fn reduce_unit_expression<'a>(cx: &LateContext, expr: &'a hir::Expr) -> Option<S
|
|||
// If block only contains statements,
|
||||
// reduce `{ X; }` to `X` or `X;`
|
||||
match inner_stmt.node {
|
||||
hir::StmtDecl(ref d, _) => Some(d.span),
|
||||
hir::StmtExpr(ref e, _) => Some(e.span),
|
||||
hir::StmtSemi(_, _) => Some(inner_stmt.span),
|
||||
hir::StmtKind::Decl(ref d, _) => Some(d.span),
|
||||
hir::StmtKind::Expr(ref e, _) => Some(e.span),
|
||||
hir::StmtKind::Semi(_, _) => Some(inner_stmt.span),
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
|
@ -247,7 +247,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||
return;
|
||||
}
|
||||
|
||||
if let hir::StmtSemi(ref expr, _) = stmt.node {
|
||||
if let hir::StmtKind::Semi(ref expr, _) = stmt.node {
|
||||
if let hir::ExprKind::MethodCall(_, _, _) = expr.node {
|
||||
if let Some(arglists) = method_chain_args(expr, &["map"]) {
|
||||
lint_map_unit_fn(cx, stmt, expr, arglists[0]);
|
||||
|
|
|
@ -1139,7 +1139,7 @@ fn lint_clone_on_copy(cx: &LateContext, expr: &hir::Expr, arg: &hir::Expr, arg_t
|
|||
_ => {},
|
||||
}
|
||||
hir::map::NodeStmt(stmt) => {
|
||||
if let hir::StmtDecl(ref decl, _) = stmt.node {
|
||||
if let hir::StmtKind::Decl(ref decl, _) = stmt.node {
|
||||
if let hir::DeclLocal(ref loc) = decl.node {
|
||||
if let hir::PatKind::Ref(..) = loc.pat.node {
|
||||
// let ref y = *x borrows x, let ref y = x.clone() does not
|
||||
|
|
|
@ -269,7 +269,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||
|
||||
fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, s: &'tcx Stmt) {
|
||||
if_chain! {
|
||||
if let StmtDecl(ref d, _) = s.node;
|
||||
if let StmtKind::Decl(ref d, _) = s.node;
|
||||
if let DeclLocal(ref l) = d.node;
|
||||
if let PatKind::Binding(an, _, i, None) = l.pat.node;
|
||||
if let Some(ref init) = l.init;
|
||||
|
@ -303,7 +303,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||
}
|
||||
};
|
||||
if_chain! {
|
||||
if let StmtSemi(ref expr, _) = s.node;
|
||||
if let StmtKind::Semi(ref expr, _) = s.node;
|
||||
if let ExprKind::Binary(ref binop, ref a, ref b) = expr.node;
|
||||
if binop.node == BinOpKind::And || binop.node == BinOpKind::Or;
|
||||
if let Some(sugg) = Sugg::hir_opt(cx, a);
|
||||
|
|
|
@ -184,7 +184,7 @@ enum Expression {
|
|||
fn fetch_bool_block(block: &Block) -> Expression {
|
||||
match (&*block.stmts, block.expr.as_ref()) {
|
||||
(&[], Some(e)) => fetch_bool_expr(&**e),
|
||||
(&[ref e], None) => if let StmtSemi(ref e, _) = e.node {
|
||||
(&[ref e], None) => if let StmtKind::Semi(ref e, _) = e.node {
|
||||
if let ExprKind::Ret(_) = e.node {
|
||||
fetch_bool_expr(&**e)
|
||||
} else {
|
||||
|
|
|
@ -350,7 +350,7 @@ impl<'a, 'tcx> MovedVariablesCtxt<'a, 'tcx> {
|
|||
map::Node::NodeStmt(s) => {
|
||||
// `let <pat> = x;`
|
||||
if_chain! {
|
||||
if let StmtDecl(ref decl, _) = s.node;
|
||||
if let StmtKind::Decl(ref decl, _) = s.node;
|
||||
if let DeclLocal(ref local) = decl.node;
|
||||
then {
|
||||
self.spans_need_deref
|
||||
|
|
|
@ -97,7 +97,7 @@ impl LintPass for Pass {
|
|||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
||||
fn check_stmt(&mut self, cx: &LateContext<'a, 'tcx>, stmt: &'tcx Stmt) {
|
||||
if let StmtSemi(ref expr, _) = stmt.node {
|
||||
if let StmtKind::Semi(ref expr, _) = stmt.node {
|
||||
if has_no_effect(cx, expr) {
|
||||
span_lint(cx, NO_EFFECT, stmt.span, "statement with no effect");
|
||||
} else if let Some(reduced) = reduce_expression(cx, expr) {
|
||||
|
|
|
@ -113,7 +113,7 @@ impl QuestionMarkPass {
|
|||
if_chain! {
|
||||
if block.stmts.len() == 1;
|
||||
if let Some(expr) = block.stmts.iter().last();
|
||||
if let StmtSemi(ref expr, _) = expr.node;
|
||||
if let StmtKind::Semi(ref expr, _) = expr.node;
|
||||
if let ExprKind::Ret(ref ret_expr) = expr.node;
|
||||
if let &Some(ref ret_expr) = ret_expr;
|
||||
|
||||
|
|
|
@ -110,8 +110,8 @@ fn check_block<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, block: &'tcx Block, binding
|
|||
let len = bindings.len();
|
||||
for stmt in &block.stmts {
|
||||
match stmt.node {
|
||||
StmtDecl(ref decl, _) => check_decl(cx, decl, bindings),
|
||||
StmtExpr(ref e, _) | StmtSemi(ref e, _) => check_expr(cx, e, bindings),
|
||||
StmtKind::Decl(ref decl, _) => check_decl(cx, decl, bindings),
|
||||
StmtKind::Expr(ref e, _) | StmtKind::Semi(ref e, _) => check_expr(cx, e, bindings),
|
||||
}
|
||||
}
|
||||
if let Some(ref o) = block.expr {
|
||||
|
|
|
@ -61,17 +61,17 @@ fn check_manual_swap(cx: &LateContext, block: &Block) {
|
|||
for w in block.stmts.windows(3) {
|
||||
if_chain! {
|
||||
// let t = foo();
|
||||
if let StmtDecl(ref tmp, _) = w[0].node;
|
||||
if let StmtKind::Decl(ref tmp, _) = w[0].node;
|
||||
if let DeclLocal(ref tmp) = tmp.node;
|
||||
if let Some(ref tmp_init) = tmp.init;
|
||||
if let PatKind::Binding(_, _, ident, None) = tmp.pat.node;
|
||||
|
||||
// foo() = bar();
|
||||
if let StmtSemi(ref first, _) = w[1].node;
|
||||
if let StmtKind::Semi(ref first, _) = w[1].node;
|
||||
if let ExprKind::Assign(ref lhs1, ref rhs1) = first.node;
|
||||
|
||||
// bar() = t;
|
||||
if let StmtSemi(ref second, _) = w[2].node;
|
||||
if let StmtKind::Semi(ref second, _) = w[2].node;
|
||||
if let ExprKind::Assign(ref lhs2, ref rhs2) = second.node;
|
||||
if let ExprKind::Path(QPath::Resolved(None, ref rhs2)) = rhs2.node;
|
||||
if rhs2.segments.len() == 1;
|
||||
|
@ -145,8 +145,8 @@ fn check_manual_swap(cx: &LateContext, block: &Block) {
|
|||
fn check_suspicious_swap(cx: &LateContext, block: &Block) {
|
||||
for w in block.stmts.windows(2) {
|
||||
if_chain! {
|
||||
if let StmtSemi(ref first, _) = w[0].node;
|
||||
if let StmtSemi(ref second, _) = w[1].node;
|
||||
if let StmtKind::Semi(ref first, _) = w[0].node;
|
||||
if let StmtKind::Semi(ref second, _) = w[1].node;
|
||||
if !differing_macro_contexts(first.span, second.span);
|
||||
if let ExprKind::Assign(ref lhs0, ref rhs0) = first.node;
|
||||
if let ExprKind::Assign(ref lhs1, ref rhs1) = second.node;
|
||||
|
|
|
@ -40,7 +40,7 @@ impl LintPass for UnusedIoAmount {
|
|||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedIoAmount {
|
||||
fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) {
|
||||
let expr = match s.node {
|
||||
hir::StmtSemi(ref expr, _) | hir::StmtExpr(ref expr, _) => &**expr,
|
||||
hir::StmtKind::Semi(ref expr, _) | hir::StmtKind::Expr(ref expr, _) => &**expr,
|
||||
_ => return,
|
||||
};
|
||||
|
||||
|
|
|
@ -592,9 +592,9 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
|
|||
let current = format!("{}.node", self.current);
|
||||
match s.node {
|
||||
// Could be an item or a local (let) binding:
|
||||
StmtDecl(ref decl, _) => {
|
||||
StmtKind::Decl(ref decl, _) => {
|
||||
let decl_pat = self.next("decl");
|
||||
println!("StmtDecl(ref {}, _) = {}", decl_pat, current);
|
||||
println!("StmtKind::Decl(ref {}, _) = {}", decl_pat, current);
|
||||
print!(" if let Decl_::");
|
||||
let current = format!("{}.node", decl_pat);
|
||||
match decl.node {
|
||||
|
@ -619,17 +619,17 @@ impl<'tcx> Visitor<'tcx> for PrintVisitor {
|
|||
}
|
||||
|
||||
// Expr without trailing semi-colon (must have unit type):
|
||||
StmtExpr(ref e, _) => {
|
||||
StmtKind::Expr(ref e, _) => {
|
||||
let e_pat = self.next("e");
|
||||
println!("StmtExpr(ref {}, _) = {}", e_pat, current);
|
||||
println!("StmtKind::Expr(ref {}, _) = {}", e_pat, current);
|
||||
self.current = e_pat;
|
||||
self.visit_expr(e);
|
||||
},
|
||||
|
||||
// Expr with trailing semi-colon (may have any type):
|
||||
StmtSemi(ref e, _) => {
|
||||
StmtKind::Semi(ref e, _) => {
|
||||
let e_pat = self.next("e");
|
||||
println!("StmtSemi(ref {}, _) = {}", e_pat, current);
|
||||
println!("StmtKind::Semi(ref {}, _) = {}", e_pat, current);
|
||||
self.current = e_pat;
|
||||
self.visit_expr(e);
|
||||
},
|
||||
|
|
|
@ -191,9 +191,9 @@ pub fn for_loop(expr: &hir::Expr) -> Option<(&hir::Pat, &hir::Expr, &hir::Expr)>
|
|||
if let hir::ExprKind::Loop(ref block, _, _) = arms[0].body.node;
|
||||
if block.expr.is_none();
|
||||
if let [ _, _, ref let_stmt, ref body ] = *block.stmts;
|
||||
if let hir::StmtDecl(ref decl, _) = let_stmt.node;
|
||||
if let hir::StmtKind::Decl(ref decl, _) = let_stmt.node;
|
||||
if let hir::DeclLocal(ref decl) = decl.node;
|
||||
if let hir::StmtExpr(ref expr, _) = body.node;
|
||||
if let hir::StmtKind::Expr(ref expr, _) = body.node;
|
||||
then {
|
||||
return Some((&*decl.pat, &iterargs[0], expr));
|
||||
}
|
||||
|
|
|
@ -43,14 +43,14 @@ impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
|
|||
/// Check whether two statements are the same.
|
||||
pub fn eq_stmt(&mut self, left: &Stmt, right: &Stmt) -> bool {
|
||||
match (&left.node, &right.node) {
|
||||
(&StmtDecl(ref l, _), &StmtDecl(ref r, _)) => {
|
||||
(&StmtKind::Decl(ref l, _), &StmtKind::Decl(ref r, _)) => {
|
||||
if let (&DeclLocal(ref l), &DeclLocal(ref r)) = (&l.node, &r.node) {
|
||||
both(&l.ty, &r.ty, |l, r| self.eq_ty(l, r)) && both(&l.init, &r.init, |l, r| self.eq_expr(l, r))
|
||||
} else {
|
||||
false
|
||||
}
|
||||
},
|
||||
(&StmtExpr(ref l, _), &StmtExpr(ref r, _)) | (&StmtSemi(ref l, _), &StmtSemi(ref r, _)) => {
|
||||
(&StmtKind::Expr(ref l, _), &StmtKind::Expr(ref r, _)) | (&StmtKind::Semi(ref l, _), &StmtKind::Semi(ref r, _)) => {
|
||||
self.eq_expr(l, r)
|
||||
},
|
||||
_ => false,
|
||||
|
@ -613,8 +613,8 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
|
|||
|
||||
pub fn hash_stmt(&mut self, b: &Stmt) {
|
||||
match b.node {
|
||||
StmtDecl(ref decl, _) => {
|
||||
let c: fn(_, _) -> _ = StmtDecl;
|
||||
StmtKind::Decl(ref decl, _) => {
|
||||
let c: fn(_, _) -> _ = StmtKind::Decl;
|
||||
c.hash(&mut self.s);
|
||||
|
||||
if let DeclLocal(ref local) = decl.node {
|
||||
|
@ -623,13 +623,13 @@ impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
},
|
||||
StmtExpr(ref expr, _) => {
|
||||
let c: fn(_, _) -> _ = StmtExpr;
|
||||
StmtKind::Expr(ref expr, _) => {
|
||||
let c: fn(_, _) -> _ = StmtKind::Expr;
|
||||
c.hash(&mut self.s);
|
||||
self.hash_expr(expr);
|
||||
},
|
||||
StmtSemi(ref expr, _) => {
|
||||
let c: fn(_, _) -> _ = StmtSemi;
|
||||
StmtKind::Semi(ref expr, _) => {
|
||||
let c: fn(_, _) -> _ = StmtKind::Semi;
|
||||
c.hash(&mut self.s);
|
||||
self.hash_expr(expr);
|
||||
},
|
||||
|
|
|
@ -122,8 +122,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
|
|||
return;
|
||||
}
|
||||
match stmt.node {
|
||||
hir::StmtDecl(ref decl, _) => print_decl(cx, decl),
|
||||
hir::StmtExpr(ref e, _) | hir::StmtSemi(ref e, _) => print_expr(cx, e, 0),
|
||||
hir::StmtKind::Decl(ref decl, _) => print_decl(cx, decl),
|
||||
hir::StmtKind::Expr(ref e, _) | hir::StmtKind::Semi(ref e, _) => print_expr(cx, e, 0),
|
||||
}
|
||||
}
|
||||
// fn check_foreign_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
if_chain! {
|
||||
if let Stmt_::StmtDecl(ref decl, _) = stmt.node
|
||||
if let StmtKind::Decl(ref decl, _) = stmt.node
|
||||
if let Decl_::DeclLocal(ref local) = decl.node;
|
||||
if let Some(ref init) = local.init
|
||||
if let ExprKind::Cast(ref expr, ref cast_ty) = init.node;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
if_chain! {
|
||||
if let Stmt_::StmtDecl(ref decl, _) = stmt.node
|
||||
if let StmtKind::Decl(ref decl, _) = stmt.node
|
||||
if let Decl_::DeclLocal(ref local) = decl.node;
|
||||
if let Some(ref init) = local.init
|
||||
if let ExprKind::Call(ref func, ref args) = init.node;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
if_chain! {
|
||||
if let ExprKind::Block(ref block) = expr.node;
|
||||
if let Stmt_::StmtDecl(ref decl, _) = block.node
|
||||
if let StmtKind::Decl(ref decl, _) = block.node
|
||||
if let Decl_::DeclLocal(ref local) = decl.node;
|
||||
if let Some(ref init) = local.init
|
||||
if let ExprKind::Match(ref expr, ref arms, MatchSource::ForLoopDesugar) = init.node;
|
||||
|
@ -14,11 +14,11 @@ if_chain! {
|
|||
// unimplemented: field checks
|
||||
if arms.len() == 1;
|
||||
if let ExprKind::Loop(ref body, ref label, LoopSource::ForLoop) = arms[0].body.node;
|
||||
if let Stmt_::StmtDecl(ref decl1, _) = body.node
|
||||
if let StmtKind::Decl(ref decl1, _) = body.node
|
||||
if let Decl_::DeclLocal(ref local1) = decl1.node;
|
||||
if let PatKind::Binding(BindingAnnotation::Mutable, _, name, None) = local1.pat.node;
|
||||
if name.node.as_str() == "__next";
|
||||
if let Stmt_::StmtExpr(ref e, _) = local1.pat.node
|
||||
if let StmtKind::Expr(ref e, _) = local1.pat.node
|
||||
if let ExprKind::Match(ref expr1, ref arms1, MatchSource::ForLoopDesugar) = e.node;
|
||||
if let ExprKind::Call(ref func1, ref args1) = expr1.node;
|
||||
if let ExprKind::Path(ref path2) = func1.node;
|
||||
|
@ -42,16 +42,16 @@ if_chain! {
|
|||
if arms1[1].pats.len() == 1;
|
||||
if let PatKind::Path(ref path7) = arms1[1].pats[0].node;
|
||||
if match_qpath(path7, &["{{root}}", "std", "option", "Option", "None"]);
|
||||
if let Stmt_::StmtDecl(ref decl2, _) = path7.node
|
||||
if let StmtKind::Decl(ref decl2, _) = path7.node
|
||||
if let Decl_::DeclLocal(ref local2) = decl2.node;
|
||||
if let Some(ref init1) = local2.init
|
||||
if let ExprKind::Path(ref path8) = init1.node;
|
||||
if match_qpath(path8, &["__next"]);
|
||||
if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local2.pat.node;
|
||||
if name1.node.as_str() == "y";
|
||||
if let Stmt_::StmtExpr(ref e1, _) = local2.pat.node
|
||||
if let StmtKind::Expr(ref e1, _) = local2.pat.node
|
||||
if let ExprKind::Block(ref block1) = e1.node;
|
||||
if let Stmt_::StmtDecl(ref decl3, _) = block1.node
|
||||
if let StmtKind::Decl(ref decl3, _) = block1.node
|
||||
if let Decl_::DeclLocal(ref local3) = decl3.node;
|
||||
if let Some(ref init2) = local3.init
|
||||
if let ExprKind::Path(ref path9) = init2.node;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
if_chain! {
|
||||
if let Stmt_::StmtDecl(ref decl, _) = stmt.node
|
||||
if let StmtKind::Decl(ref decl, _) = stmt.node
|
||||
if let Decl_::DeclLocal(ref local) = decl.node;
|
||||
if let Some(ref init) = local.init
|
||||
if let ExprKind::Match(ref expr, ref arms, MatchSource::Normal) = init.node;
|
||||
|
@ -13,7 +13,7 @@ if_chain! {
|
|||
if let ExprKind::Lit(ref lit2) = lit_expr.node;
|
||||
if let LitKind::Int(16, _) = lit2.node;
|
||||
if let ExprKind::Block(ref block) = arms[1].body.node;
|
||||
if let Stmt_::StmtDecl(ref decl1, _) = block.node
|
||||
if let StmtKind::Decl(ref decl1, _) = block.node
|
||||
if let Decl_::DeclLocal(ref local1) = decl1.node;
|
||||
if let Some(ref init1) = local1.init
|
||||
if let ExprKind::Lit(ref lit3) = init1.node;
|
||||
|
|
Loading…
Reference in a new issue