rust/tests/ui/author/struct.stdout

65 lines
2.3 KiB
Plaintext
Raw Normal View History

2021-10-28 20:39:41 -05:00
if_chain! {
2021-11-10 15:59:49 -06:00
if let ExprKind::Struct(qpath, fields, None) = expr.kind;
2021-11-08 17:05:37 -06:00
if match_qpath(qpath, &["Test"]);
2021-10-28 20:39:41 -05:00
if fields.len() == 1;
2021-11-05 17:05:04 -05:00
if fields[0].ident.as_str() == "field";
if let ExprKind::If(cond, then, Some(else_expr)) = fields[0].expr.kind;
if let ExprKind::DropTemps(expr1) = cond.kind;
if let ExprKind::Lit(ref lit) = expr1.kind;
2021-10-28 20:39:41 -05:00
if let LitKind::Bool(true) = lit.node;
2021-11-05 17:05:04 -05:00
if let ExprKind::Block(block, None) = then.kind;
if block.stmts.is_empty();
2021-11-10 15:59:49 -06:00
if let Some(trailing_expr) = block.expr;
2021-10-28 20:39:41 -05:00
if let ExprKind::Lit(ref lit1) = trailing_expr.kind;
if let LitKind::Int(1, LitIntType::Unsuffixed) = lit1.node;
2021-11-05 17:05:04 -05:00
if let ExprKind::Block(block1, None) = else_expr.kind;
if block1.stmts.is_empty();
2021-11-10 15:59:49 -06:00
if let Some(trailing_expr1) = block1.expr;
2021-10-28 20:39:41 -05:00
if let ExprKind::Lit(ref lit2) = trailing_expr1.kind;
if let LitKind::Int(0, LitIntType::Unsuffixed) = lit2.node;
then {
// report your lint here
}
}
if_chain! {
2021-11-05 17:05:04 -05:00
if let PatKind::Struct(ref qpath, fields, false) = arm.pat.kind;
2021-11-08 17:05:37 -06:00
if match_qpath(qpath, &["Test"]);
2021-10-28 20:39:41 -05:00
if fields.len() == 1;
2021-11-05 17:05:04 -05:00
if fields[0].ident.as_str() == "field";
if let PatKind::Lit(lit_expr) = fields[0].pat.kind;
2021-10-28 20:39:41 -05:00
if let ExprKind::Lit(ref lit) = lit_expr.kind;
if let LitKind::Int(1, LitIntType::Unsuffixed) = lit.node;
2021-11-05 17:05:04 -05:00
if arm.guard.is_none();
if let ExprKind::Block(block, None) = arm.body.kind;
if block.stmts.is_empty();
2021-10-28 20:39:41 -05:00
if block.expr.is_none();
then {
// report your lint here
}
}
if_chain! {
2021-11-05 17:05:04 -05:00
if let PatKind::TupleStruct(ref qpath, fields, None) = arm.pat.kind;
2021-11-08 17:05:37 -06:00
if match_qpath(qpath, &["TestTuple"]);
2021-10-28 20:39:41 -05:00
if fields.len() == 1;
2021-11-10 15:59:49 -06:00
if let PatKind::Lit(lit_expr) = fields[0].kind;
2021-10-28 20:39:41 -05:00
if let ExprKind::Lit(ref lit) = lit_expr.kind;
if let LitKind::Int(1, LitIntType::Unsuffixed) = lit.node;
2021-11-05 17:05:04 -05:00
if arm.guard.is_none();
if let ExprKind::Block(block, None) = arm.body.kind;
if block.stmts.is_empty();
2021-10-28 20:39:41 -05:00
if block.expr.is_none();
then {
// report your lint here
}
}
if_chain! {
2021-11-10 15:59:49 -06:00
if let ExprKind::MethodCall(method_name, _, args, _) = expr.kind;
2021-11-05 17:05:04 -05:00
if method_name.ident.as_str() == "test";
2021-10-28 20:39:41 -05:00
if args.len() == 1;
2021-11-08 17:05:37 -06:00
if let ExprKind::Path(ref qpath) = args[0].kind;
if match_qpath(qpath, &["test_method_call"]);
2021-10-28 20:39:41 -05:00
then {
// report your lint here
}
}