rust/tests/ui/author/matches.stout

39 lines
1.7 KiB
Plaintext
Raw Normal View History

if_chain! {
2018-07-12 03:53:53 -05:00
if let StmtKind::Decl(ref decl, _) = stmt.node
2018-07-12 03:55:41 -05:00
if let DeclKind::Local(ref local) = decl.node;
2019-03-07 07:07:01 -06:00
if let Some(ref init) = local.init;
2018-07-12 02:30:57 -05:00
if let ExprKind::Match(ref expr, ref arms, MatchSource::Normal) = init.node;
if let ExprKind::Lit(ref lit) = expr.node;
if let LitKind::Int(42, _) = lit.node;
if arms.len() == 3;
2018-07-12 02:30:57 -05:00
if let ExprKind::Lit(ref lit1) = arms[0].body.node;
if let LitKind::Int(5, _) = lit1.node;
if arms[0].pats.len() == 1;
if let PatKind::Lit(ref lit_expr) = arms[0].pats[0].node
2018-07-12 02:30:57 -05:00
if let ExprKind::Lit(ref lit2) = lit_expr.node;
if let LitKind::Int(16, _) = lit2.node;
2018-07-12 02:30:57 -05:00
if let ExprKind::Block(ref block) = arms[1].body.node;
2018-07-12 03:53:53 -05:00
if let StmtKind::Decl(ref decl1, _) = block.node
2018-07-12 03:55:41 -05:00
if let DeclKind::Local(ref local1) = decl1.node;
if let Some(ref init1) = local1.init
2018-07-12 02:30:57 -05:00
if let ExprKind::Lit(ref lit3) = init1.node;
if let LitKind::Int(3, _) = lit3.node;
if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local1.pat.node;
if name.node.as_str() == "x";
2018-07-12 02:30:57 -05:00
if let ExprKind::Path(ref path) = local1.pat.node;
if match_qpath(path, &["x"]);
if arms[1].pats.len() == 1;
if let PatKind::Lit(ref lit_expr1) = arms[1].pats[0].node
2018-07-12 02:30:57 -05:00
if let ExprKind::Lit(ref lit4) = lit_expr1.node;
if let LitKind::Int(17, _) = lit4.node;
2018-07-12 02:30:57 -05:00
if let ExprKind::Lit(ref lit5) = arms[2].body.node;
if let LitKind::Int(1, _) = lit5.node;
if arms[2].pats.len() == 1;
if let PatKind::Wild = arms[2].pats[0].node;
if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local.pat.node;
if name1.node.as_str() == "a";
then {
// report your lint here
}
}