rust/tests/ui/author/matches.stdout

39 lines
1.7 KiB
Plaintext
Raw Normal View History

2019-09-27 11:01:04 -05:00
if_chain! {
2021-11-10 15:59:49 -06:00
if let StmtKind::Local(local) = stmt.kind;
if let Some(init) = local.init;
if let ExprKind::Match(scrutinee, arms, MatchSource::Normal) = init.kind;
2021-11-08 17:47:33 -06:00
if let ExprKind::Lit(ref lit) = scrutinee.kind;
2021-10-28 20:39:41 -05:00
if let LitKind::Int(42, LitIntType::Unsuffixed) = lit.node;
2019-09-27 11:01:04 -05:00
if arms.len() == 3;
2021-11-10 15:59:49 -06:00
if let PatKind::Lit(lit_expr) = arms[0].pat.kind;
2021-11-08 17:47:33 -06:00
if let ExprKind::Lit(ref lit1) = lit_expr.kind;
if let LitKind::Int(16, LitIntType::Unsuffixed) = lit1.node;
2021-11-05 17:05:04 -05:00
if arms[0].guard.is_none();
2021-11-08 17:47:33 -06:00
if let ExprKind::Lit(ref lit2) = arms[0].body.kind;
if let LitKind::Int(5, LitIntType::Unsuffixed) = lit2.node;
2021-11-10 15:59:49 -06:00
if let PatKind::Lit(lit_expr1) = arms[1].pat.kind;
2021-11-08 17:47:33 -06:00
if let ExprKind::Lit(ref lit3) = lit_expr1.kind;
if let LitKind::Int(17, LitIntType::Unsuffixed) = lit3.node;
2021-11-05 17:05:04 -05:00
if arms[1].guard.is_none();
if let ExprKind::Block(block, None) = arms[1].body.kind;
2019-09-27 11:01:04 -05:00
if block.stmts.len() == 1;
2021-11-10 15:59:49 -06:00
if let StmtKind::Local(local1) = block.stmts[0].kind;
if let Some(init1) = local1.init;
2021-11-08 17:47:33 -06:00
if let ExprKind::Lit(ref lit4) = init1.kind;
if let LitKind::Int(3, LitIntType::Unsuffixed) = lit4.node;
2019-09-27 11:01:04 -05:00
if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local1.pat.kind;
if name.as_str() == "x";
2021-11-10 15:59:49 -06:00
if let Some(trailing_expr) = block.expr;
2021-11-08 17:05:37 -06:00
if let ExprKind::Path(ref qpath) = trailing_expr.kind;
if match_qpath(qpath, &["x"]);
2021-11-08 17:47:33 -06:00
if let PatKind::Wild = arms[2].pat.kind;
2021-11-05 17:05:04 -05:00
if arms[2].guard.is_none();
2019-09-27 11:01:04 -05:00
if let ExprKind::Lit(ref lit5) = arms[2].body.kind;
2021-10-28 20:39:41 -05:00
if let LitKind::Int(1, LitIntType::Unsuffixed) = lit5.node;
2019-09-27 11:01:04 -05:00
if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local.pat.kind;
if name1.as_str() == "a";
then {
// report your lint here
}
}