diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/tools/clippy/tests/ui/author/struct.stdout | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/tools/clippy/tests/ui/author/struct.stdout | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/author/struct.stdout b/src/tools/clippy/tests/ui/author/struct.stdout new file mode 100644 index 000000000..5e78b7c9d --- /dev/null +++ b/src/tools/clippy/tests/ui/author/struct.stdout @@ -0,0 +1,64 @@ +if_chain! { + if let ExprKind::Struct(qpath, fields, None) = expr.kind; + if match_qpath(qpath, &["Test"]); + if fields.len() == 1; + 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; + if let LitKind::Bool(true) = lit.node; + if let ExprKind::Block(block, None) = then.kind; + if block.stmts.is_empty(); + if let Some(trailing_expr) = block.expr; + if let ExprKind::Lit(ref lit1) = trailing_expr.kind; + if let LitKind::Int(1, LitIntType::Unsuffixed) = lit1.node; + if let ExprKind::Block(block1, None) = else_expr.kind; + if block1.stmts.is_empty(); + if let Some(trailing_expr1) = block1.expr; + 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! { + if let PatKind::Struct(ref qpath, fields, false) = arm.pat.kind; + if match_qpath(qpath, &["Test"]); + if fields.len() == 1; + if fields[0].ident.as_str() == "field"; + if let PatKind::Lit(lit_expr) = fields[0].pat.kind; + if let ExprKind::Lit(ref lit) = lit_expr.kind; + if let LitKind::Int(1, LitIntType::Unsuffixed) = lit.node; + if arm.guard.is_none(); + if let ExprKind::Block(block, None) = arm.body.kind; + if block.stmts.is_empty(); + if block.expr.is_none(); + then { + // report your lint here + } +} +if_chain! { + if let PatKind::TupleStruct(ref qpath, fields, None) = arm.pat.kind; + if match_qpath(qpath, &["TestTuple"]); + if fields.len() == 1; + if let PatKind::Lit(lit_expr) = fields[0].kind; + if let ExprKind::Lit(ref lit) = lit_expr.kind; + if let LitKind::Int(1, LitIntType::Unsuffixed) = lit.node; + if arm.guard.is_none(); + if let ExprKind::Block(block, None) = arm.body.kind; + if block.stmts.is_empty(); + if block.expr.is_none(); + then { + // report your lint here + } +} +if_chain! { + if let ExprKind::MethodCall(method_name, args, _) = expr.kind; + if method_name.ident.as_str() == "test"; + if args.len() == 1; + if let ExprKind::Path(ref qpath) = args[0].kind; + if match_qpath(qpath, &["test_method_call"]); + then { + // report your lint here + } +} |