From bc1de58d2652bc85b9f588ef12262ff1bb734e49 Mon Sep 17 00:00:00 2001 From: Andrea Lattuada Date: Sun, 27 May 2018 16:04:28 +0200 Subject: [PATCH] Test for ExprCall in clippy::author --- tests/ui/author/call.rs | 6 ++++++ tests/ui/author/call.stdout | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 tests/ui/author/call.rs create mode 100644 tests/ui/author/call.stdout diff --git a/tests/ui/author/call.rs b/tests/ui/author/call.rs new file mode 100755 index 000000000000..8d085112f3bd --- /dev/null +++ b/tests/ui/author/call.rs @@ -0,0 +1,6 @@ +#![feature(tool_attributes)] + +fn main() { + #[clippy::author] + let _ = ::std::cmp::min(3, 4); +} diff --git a/tests/ui/author/call.stdout b/tests/ui/author/call.stdout new file mode 100644 index 000000000000..3e06bf9ace8b --- /dev/null +++ b/tests/ui/author/call.stdout @@ -0,0 +1,17 @@ +if_chain! { + if let Stmt_::StmtDecl(ref decl, _) = stmt.node + if let Decl_::DeclLocal(ref local) = decl.node; + if let Some(ref init) = local.init + if let Expr_::ExprCall(ref func, ref args) = init.node; + if let Expr_::ExprPath(ref path) = func.node; + if match_qpath(path, &["{{root}}", "std", "cmp", "min"]); + if args.len() == 2; + if let Expr_::ExprLit(ref lit) = args[0].node; + if let LitKind::Int(3, _) = lit.node; + if let Expr_::ExprLit(ref lit1) = args[1].node; + if let LitKind::Int(4, _) = lit1.node; + if let PatKind::Wild = local.pat.node; + then { + // report your lint here + } +}