about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCameron Steffen <cam.steffen94@gmail.com>2021-11-08 17:05:37 -0600
committerCameron Steffen <cam.steffen94@gmail.com>2021-11-10 15:40:50 -0600
commitce01346ac1168272c2ec2d4c272fbc1f27f39aae (patch)
tree9ff344a7e0ee6c043665632a5e4d2a90997553f4
parente3d1e60ed961c581092af4daa0442fc43b9c6068 (diff)
downloadrust-ce01346ac1168272c2ec2d4c272fbc1f27f39aae.tar.gz
rust-ce01346ac1168272c2ec2d4c272fbc1f27f39aae.zip
author: name qpath consistently
-rw-r--r--clippy_lints/src/utils/author.rs12
-rw-r--r--tests/ui/author.stdout4
-rw-r--r--tests/ui/author/blocks.stdout20
-rw-r--r--tests/ui/author/call.stdout4
-rw-r--r--tests/ui/author/if.stdout4
-rw-r--r--tests/ui/author/issue_3849.stdout8
-rw-r--r--tests/ui/author/loop.stdout24
-rw-r--r--tests/ui/author/matches.stdout4
-rw-r--r--tests/ui/author/struct.stdout16
9 files changed, 48 insertions, 48 deletions
diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs
index 38157cc16ef..26b2a89d2ce 100644
--- a/clippy_lints/src/utils/author.rs
+++ b/clippy_lints/src/utils/author.rs
@@ -569,7 +569,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrintVisitor<'a, '_> {
             ExprKind::Cast(expr, ty) => {
                 let cast_pat = self.next("expr");
                 let cast_ty = self.next("cast_ty");
-                let qp_label = self.next("qp");
+                let qp_label = self.next("qpath");
 
                 println!("Cast(ref {}, ref {}) = {};", cast_pat, cast_ty, current);
 
@@ -717,7 +717,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrintVisitor<'a, '_> {
                 self.visit_expr(index);
             },
             ExprKind::Path(ref path) => {
-                let path_pat = self.next("path");
+                let path_pat = self.next("qpath");
 
                 println!("Path(ref {}) = {};", path_pat, current);
 
@@ -780,7 +780,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrintVisitor<'a, '_> {
                 println!("    // unimplemented: `ExprKind::LlvmInlineAsm` is not further destructured at the moment");
             },
             ExprKind::Struct(path, fields, ref opt_base) => {
-                let path_pat = self.next("path");
+                let path_pat = self.next("qpath");
                 let fields_pat = self.next("fields");
 
                 if let Some(base) = *opt_base {
@@ -895,7 +895,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrintVisitor<'a, '_> {
                 println!("    if {}.as_str() == \"{}\";", name_pat, ident.as_str());
             },
             PatKind::Struct(ref path, fields, ignore) => {
-                let path_pat = self.next("path");
+                let path_pat = self.next("qpath");
                 let fields_pat = self.next("fields");
                 println!(
                     "Struct(ref {}, ref {}, {}) = {};",
@@ -930,7 +930,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrintVisitor<'a, '_> {
                 }
             },
             PatKind::TupleStruct(ref path, fields, skip_pos) => {
-                let path_pat = self.next("path");
+                let path_pat = self.next("qpath");
                 let fields_pat = self.next("fields");
 
                 println!(
@@ -949,7 +949,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrintVisitor<'a, '_> {
                 }
             },
             PatKind::Path(ref path) => {
-                let path_pat = self.next("path");
+                let path_pat = self.next("qpath");
                 println!("Path(ref {}) = {};", path_pat, current);
 
                 self.current = path_pat;
diff --git a/tests/ui/author.stdout b/tests/ui/author.stdout
index 313597bf534..4931270bea8 100644
--- a/tests/ui/author.stdout
+++ b/tests/ui/author.stdout
@@ -2,8 +2,8 @@ if_chain! {
     if let StmtKind::Local(ref local) = stmt.kind;
     if let Some(ref init) = local.init;
     if let ExprKind::Cast(ref expr, ref cast_ty) = init.kind;
-    if let TyKind::Path(ref qp) = cast_ty.kind;
-    if match_qpath(qp, &["char"]);
+    if let TyKind::Path(ref qpath) = cast_ty.kind;
+    if match_qpath(qpath, &["char"]);
     if let ExprKind::Lit(ref lit) = expr.kind;
     if let LitKind::Int(69, LitIntType::Unsuffixed) = lit.node;
     if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local.pat.kind;
diff --git a/tests/ui/author/blocks.stdout b/tests/ui/author/blocks.stdout
index 31c7fced7f7..3454d2bd69c 100644
--- a/tests/ui/author/blocks.stdout
+++ b/tests/ui/author/blocks.stdout
@@ -15,8 +15,8 @@ if_chain! {
     if name1.as_str() == "_t";
     if let StmtKind::Semi(ref e, _) = block.stmts[2].kind
     if let ExprKind::Unary(UnOp::Neg, ref inner) = e.kind;
-    if let ExprKind::Path(ref path) = inner.kind;
-    if match_qpath(path, &["x"]);
+    if let ExprKind::Path(ref qpath) = inner.kind;
+    if match_qpath(qpath, &["x"]);
     if block.expr.is_none();
     then {
         // report your lint here
@@ -28,18 +28,18 @@ if_chain! {
     if let StmtKind::Local(ref local) = block.stmts[0].kind;
     if let Some(ref init) = local.init;
     if let ExprKind::Call(ref func, ref args) = init.kind;
-    if let ExprKind::Path(ref path) = func.kind;
-    if match_qpath(path, &["String", "new"]);
+    if let ExprKind::Path(ref qpath) = func.kind;
+    if match_qpath(qpath, &["String", "new"]);
     if args.len() == 0;
     if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local.pat.kind;
     if name.as_str() == "expr";
     if let Some(trailing_expr) = &block.expr;
     if let ExprKind::Call(ref func1, ref args1) = trailing_expr.kind;
-    if let ExprKind::Path(ref path1) = func1.kind;
-    if match_qpath(path1, &["drop"]);
+    if let ExprKind::Path(ref qpath1) = func1.kind;
+    if match_qpath(qpath1, &["drop"]);
     if args1.len() == 1;
-    if let ExprKind::Path(ref path2) = args1[0].kind;
-    if match_qpath(path2, &["expr"]);
+    if let ExprKind::Path(ref qpath2) = args1[0].kind;
+    if match_qpath(qpath2, &["expr"]);
     then {
         // report your lint here
     }
@@ -49,8 +49,8 @@ if_chain! {
     if let FnRetTy::DefaultReturn(_) = fn_decl.output
     let body = cx.tcx.hir().body(body_id);
     if let ExprKind::Call(ref func, ref args) = body.value.kind;
-    if let ExprKind::Path(ref path) = func.kind;
-    if matches!(path, QPath::LangItem(LangItem::FromGenerator, _));
+    if let ExprKind::Path(ref qpath) = func.kind;
+    if matches!(qpath, QPath::LangItem(LangItem::FromGenerator, _));
     if args.len() == 1;
     if let ExprKind::Closure(CaptureBy::Value, ref fn_decl1, ref body_id1, _, Some(Movability::Static)) = args[0].kind
     if let FnRetTy::DefaultReturn(_) = fn_decl1.output
diff --git a/tests/ui/author/call.stdout b/tests/ui/author/call.stdout
index 07958dbc356..7bce2bb84f2 100644
--- a/tests/ui/author/call.stdout
+++ b/tests/ui/author/call.stdout
@@ -2,8 +2,8 @@ if_chain! {
     if let StmtKind::Local(ref local) = stmt.kind;
     if let Some(ref init) = local.init;
     if let ExprKind::Call(ref func, ref args) = init.kind;
-    if let ExprKind::Path(ref path) = func.kind;
-    if match_qpath(path, &["{{root}}", "std", "cmp", "min"]);
+    if let ExprKind::Path(ref qpath) = func.kind;
+    if match_qpath(qpath, &["{{root}}", "std", "cmp", "min"]);
     if args.len() == 2;
     if let ExprKind::Lit(ref lit) = args[0].kind;
     if let LitKind::Int(3, LitIntType::Unsuffixed) = lit.node;
diff --git a/tests/ui/author/if.stdout b/tests/ui/author/if.stdout
index 7e72a548011..6acdbee176a 100644
--- a/tests/ui/author/if.stdout
+++ b/tests/ui/author/if.stdout
@@ -34,8 +34,8 @@ if_chain! {
     if let PatKind::Lit(ref lit_expr) = let_pat.kind
     if let ExprKind::Lit(ref lit) = lit_expr.kind;
     if let LitKind::Bool(true) = lit.node;
-    if let ExprKind::Path(ref path) = let_expr.kind;
-    if match_qpath(path, &["a"]);
+    if let ExprKind::Path(ref qpath) = let_expr.kind;
+    if match_qpath(qpath, &["a"]);
     if let ExprKind::Block(ref block, ref label) = if_then.kind;
     if block.stmts.len() == 0;
     if block.expr.is_none();
diff --git a/tests/ui/author/issue_3849.stdout b/tests/ui/author/issue_3849.stdout
index 65f93f3cdc0..769384d79c0 100644
--- a/tests/ui/author/issue_3849.stdout
+++ b/tests/ui/author/issue_3849.stdout
@@ -2,11 +2,11 @@ if_chain! {
     if let StmtKind::Local(ref local) = stmt.kind;
     if let Some(ref init) = local.init;
     if let ExprKind::Call(ref func, ref args) = init.kind;
-    if let ExprKind::Path(ref path) = func.kind;
-    if match_qpath(path, &["std", "mem", "transmute"]);
+    if let ExprKind::Path(ref qpath) = func.kind;
+    if match_qpath(qpath, &["std", "mem", "transmute"]);
     if args.len() == 1;
-    if let ExprKind::Path(ref path1) = args[0].kind;
-    if match_qpath(path1, &["ZPTR"]);
+    if let ExprKind::Path(ref qpath1) = args[0].kind;
+    if match_qpath(qpath1, &["ZPTR"]);
     if let PatKind::Wild = local.pat.kind;
     then {
         // report your lint here
diff --git a/tests/ui/author/loop.stdout b/tests/ui/author/loop.stdout
index fa146f03495..ce1720551c5 100644
--- a/tests/ui/author/loop.stdout
+++ b/tests/ui/author/loop.stdout
@@ -3,8 +3,8 @@ if_chain! {
     if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, ..}) = higher::ForLoop::hir(expr)
     if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = pat.kind;
     if name.as_str() == "y";
-    if let ExprKind::Struct(ref path, ref fields, None) = arg.kind;
-    if matches!(path, QPath::LangItem(LangItem::Range, _));
+    if let ExprKind::Struct(ref qpath, ref fields, None) = arg.kind;
+    if matches!(qpath, QPath::LangItem(LangItem::Range, _));
     if fields.len() == 2;
     if fields[0].ident.name.as_str() == "start"
     if let ExprKind::Lit(ref lit) = fields[0].kind;
@@ -16,8 +16,8 @@ if_chain! {
     if block.stmts.len() == 1;
     if let StmtKind::Local(ref local) = block.stmts[0].kind;
     if let Some(ref init) = local.init;
-    if let ExprKind::Path(ref path1) = init.kind;
-    if match_qpath(path1, &["y"]);
+    if let ExprKind::Path(ref qpath1) = init.kind;
+    if match_qpath(qpath1, &["y"]);
     if let PatKind::Binding(BindingAnnotation::Unannotated, _, name1, None) = local.pat.kind;
     if name1.as_str() == "z";
     if block.expr.is_none();
@@ -29,8 +29,8 @@ if_chain! {
     if let ExprKind::DropTemps(ref expr) = expr.kind;
     if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, ..}) = higher::ForLoop::hir(expr)
     if let PatKind::Wild = pat.kind;
-    if let ExprKind::Struct(ref path, ref fields, None) = arg.kind;
-    if matches!(path, QPath::LangItem(LangItem::Range, _));
+    if let ExprKind::Struct(ref qpath, ref fields, None) = arg.kind;
+    if matches!(qpath, QPath::LangItem(LangItem::Range, _));
     if fields.len() == 2;
     if fields[0].ident.name.as_str() == "start"
     if let ExprKind::Lit(ref lit) = fields[0].kind;
@@ -51,8 +51,8 @@ if_chain! {
     if let ExprKind::DropTemps(ref expr) = expr.kind;
     if let Some(higher::ForLoop { pat: pat, arg: arg, body: body, ..}) = higher::ForLoop::hir(expr)
     if let PatKind::Wild = pat.kind;
-    if let ExprKind::Struct(ref path, ref fields, None) = arg.kind;
-    if matches!(path, QPath::LangItem(LangItem::Range, _));
+    if let ExprKind::Struct(ref qpath, ref fields, None) = arg.kind;
+    if matches!(qpath, QPath::LangItem(LangItem::Range, _));
     if fields.len() == 2;
     if fields[0].ident.name.as_str() == "start"
     if let ExprKind::Lit(ref lit) = fields[0].kind;
@@ -73,8 +73,8 @@ if_chain! {
 }
 if_chain! {
     if let Some(higher::While { condition: condition, body: body }) = higher::While::hir(expr)
-    if let ExprKind::Path(ref path) = condition.kind;
-    if match_qpath(path, &["a"]);
+    if let ExprKind::Path(ref qpath) = condition.kind;
+    if match_qpath(qpath, &["a"]);
     if let ExprKind::Block(ref block, ref label) = body.kind;
     if block.stmts.len() == 1;
     if let StmtKind::Semi(ref e, _) = block.stmts[0].kind
@@ -89,8 +89,8 @@ if_chain! {
     if let PatKind::Lit(ref lit_expr) = let_pat.kind
     if let ExprKind::Lit(ref lit) = lit_expr.kind;
     if let LitKind::Bool(true) = lit.node;
-    if let ExprKind::Path(ref path) = let_expr.kind;
-    if match_qpath(path, &["a"]);
+    if let ExprKind::Path(ref qpath) = let_expr.kind;
+    if match_qpath(qpath, &["a"]);
     if let ExprKind::Block(ref block, ref label) = if_then.kind;
     if block.stmts.len() == 1;
     if let StmtKind::Semi(ref e, _) = block.stmts[0].kind
diff --git a/tests/ui/author/matches.stdout b/tests/ui/author/matches.stdout
index 3be61fe3772..b802b6bff86 100644
--- a/tests/ui/author/matches.stdout
+++ b/tests/ui/author/matches.stdout
@@ -19,8 +19,8 @@ if_chain! {
     if let PatKind::Binding(BindingAnnotation::Unannotated, _, name, None) = local1.pat.kind;
     if name.as_str() == "x";
     if let Some(trailing_expr) = &block.expr;
-    if let ExprKind::Path(ref path) = trailing_expr.kind;
-    if match_qpath(path, &["x"]);
+    if let ExprKind::Path(ref qpath) = trailing_expr.kind;
+    if match_qpath(qpath, &["x"]);
     if let PatKind::Lit(ref lit_expr1) = arms[1].pat.kind
     if let ExprKind::Lit(ref lit4) = lit_expr1.kind;
     if let LitKind::Int(17, LitIntType::Unsuffixed) = lit4.node;
diff --git a/tests/ui/author/struct.stdout b/tests/ui/author/struct.stdout
index 98055d73779..52c708dc8fa 100644
--- a/tests/ui/author/struct.stdout
+++ b/tests/ui/author/struct.stdout
@@ -1,6 +1,6 @@
 if_chain! {
-    if let ExprKind::Struct(ref path, ref fields, None) = expr.kind;
-    if match_qpath(path, &["Test"]);
+    if let ExprKind::Struct(ref qpath, ref fields, None) = expr.kind;
+    if match_qpath(qpath, &["Test"]);
     if fields.len() == 1;
     if fields[0].ident.name.as_str() == "field"
     if let Some(higher::If { cond: cond, then: then, r#else: else_expr}) = higher::If::hir(fields[0])
@@ -21,8 +21,8 @@ if_chain! {
     }
 }
 if_chain! {
-    if let PatKind::Struct(ref path, ref fields, false) = arm.kind;
-    if match_qpath(path, &["Test"]);
+    if let PatKind::Struct(ref qpath, ref fields, false) = arm.kind;
+    if match_qpath(qpath, &["Test"]);
     if fields.len() == 1;
     if fields[0].ident.name.as_str() == "field"
     if let PatKind::Lit(ref lit_expr) = fields[0].kind
@@ -36,8 +36,8 @@ if_chain! {
     }
 }
 if_chain! {
-    if let PatKind::TupleStruct(ref path, ref fields, None) = arm.kind;
-    if match_qpath(path, &["TestTuple"]);
+    if let PatKind::TupleStruct(ref qpath, ref fields, None) = arm.kind;
+    if match_qpath(qpath, &["TestTuple"]);
     if fields.len() == 1;
     if let PatKind::Lit(ref lit_expr) = fields[0].kind
     if let ExprKind::Lit(ref lit) = lit_expr.kind;
@@ -53,8 +53,8 @@ if_chain! {
     if let ExprKind::MethodCall(ref method_name, ref args, _) = expr.kind;
     if method_name.ident.name.as_str() == test;
     if args.len() == 1;
-    if let ExprKind::Path(ref path) = args[0].kind;
-    if match_qpath(path, &["test_method_call"]);
+    if let ExprKind::Path(ref qpath) = args[0].kind;
+    if match_qpath(qpath, &["test_method_call"]);
     then {
         // report your lint here
     }