fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1if let ExprKind::Struct(qpath, fields, None) = expr.kind 2 && match_qpath(qpath, &["Test"]) 3 && fields.len() == 1 4 && fields[0].ident.as_str() == "field" 5 && let ExprKind::If(cond, then, Some(else_expr)) = fields[0].expr.kind 6 && let ExprKind::DropTemps(expr1) = cond.kind 7 && let ExprKind::Lit(ref lit) = expr1.kind 8 && let LitKind::Bool(true) = lit.node 9 && let ExprKind::Block(block, None) = then.kind 10 && block.stmts.is_empty() 11 && let Some(trailing_expr) = block.expr 12 && let ExprKind::Lit(ref lit1) = trailing_expr.kind 13 && let LitKind::Int(1, LitIntType::Unsuffixed) = lit1.node 14 && let ExprKind::Block(block1, None) = else_expr.kind 15 && block1.stmts.is_empty() 16 && let Some(trailing_expr1) = block1.expr 17 && let ExprKind::Lit(ref lit2) = trailing_expr1.kind 18 && let LitKind::Int(0, LitIntType::Unsuffixed) = lit2.node 19{ 20 // report your lint here 21} 22if let PatKind::Struct(ref qpath, fields, false) = arm.pat.kind 23 && match_qpath(qpath, &["Test"]) 24 && fields.len() == 1 25 && fields[0].ident.as_str() == "field" 26 && let PatKind::Lit(lit_expr) = fields[0].pat.kind 27 && let ExprKind::Lit(ref lit) = lit_expr.kind 28 && let LitKind::Int(1, LitIntType::Unsuffixed) = lit.node 29 && arm.guard.is_none() 30 && let ExprKind::Block(block, None) = arm.body.kind 31 && block.stmts.is_empty() 32 && block.expr.is_none() 33{ 34 // report your lint here 35} 36if let PatKind::TupleStruct(ref qpath, fields, None) = arm.pat.kind 37 && match_qpath(qpath, &["TestTuple"]) 38 && fields.len() == 1 39 && let PatKind::Lit(lit_expr) = fields[0].kind 40 && let ExprKind::Lit(ref lit) = lit_expr.kind 41 && let LitKind::Int(1, LitIntType::Unsuffixed) = lit.node 42 && arm.guard.is_none() 43 && let ExprKind::Block(block, None) = arm.body.kind 44 && block.stmts.is_empty() 45 && block.expr.is_none() 46{ 47 // report your lint here 48} 49if let ExprKind::MethodCall(method_name, receiver, args, _) = expr.kind 50 && method_name.ident.as_str() == "test" 51 && let ExprKind::Path(ref qpath) = receiver.kind 52 && match_qpath(qpath, &["test_method_call"]) 53 && args.is_empty() 54{ 55 // report your lint here 56}