]> git.lizzy.rs Git - rust.git/commitdiff
Rustup "Remove `Spanned` from `{ast,hir}::FieldPat`"
authorLzu Tao <taolzu@gmail.com>
Fri, 16 Aug 2019 02:30:38 +0000 (09:30 +0700)
committerLzu Tao <taolzu@gmail.com>
Fri, 16 Aug 2019 02:32:27 +0000 (09:32 +0700)
clippy_lints/src/copies.rs
clippy_lints/src/dbg_macro.rs
clippy_lints/src/misc_early.rs
clippy_lints/src/non_expressive_names.rs
clippy_lints/src/shadow.rs
clippy_lints/src/utils/inspector.rs
clippy_lints/src/utils/mod.rs
clippy_lints/src/write.rs

index 3894b56c0494b0775d89dff5214f316bab6a40d3..64239bb4dd425e7049fb0213351fa257fd3c07bc 100644 (file)
@@ -300,7 +300,7 @@ fn bindings_impl<'a, 'tcx>(
             },
             PatKind::Struct(_, ref fields, _) => {
                 for pat in fields {
-                    bindings_impl(cx, &pat.node.pat, map);
+                    bindings_impl(cx, &pat.pat, map);
                 }
             },
             PatKind::Tuple(ref fields, _) => {
index ff76b35fa21bdc98be291bb50b5e4f480e16b226..1dcdaac9b862a3ef82b97a01421a7eee0d3b7790 100644 (file)
@@ -31,8 +31,8 @@
 
 impl EarlyLintPass for DbgMacro {
     fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &ast::Mac) {
-        if mac.node.path == sym!(dbg) {
-            if let Some(sugg) = tts_span(mac.node.tts.clone()).and_then(|span| snippet_opt(cx, span)) {
+        if mac.path == sym!(dbg) {
+            if let Some(sugg) = tts_span(mac.tts.clone()).and_then(|span| snippet_opt(cx, span)) {
                 span_lint_and_sugg(
                     cx,
                     DBG_MACRO,
index 7d6f29c521b37fb3a327531fbede4a7e988f03a8..b998d3f8a331acf01eeee09a40e7e3647f535854 100644 (file)
@@ -234,7 +234,7 @@ fn check_pat(&mut self, cx: &EarlyContext<'_>, pat: &Pat) {
                 .name;
 
             for field in pfields {
-                if let PatKind::Wild = field.node.pat.node {
+                if let PatKind::Wild = field.pat.node {
                     wilds += 1;
                 }
             }
@@ -252,7 +252,7 @@ fn check_pat(&mut self, cx: &EarlyContext<'_>, pat: &Pat) {
                 let mut normal = vec![];
 
                 for field in pfields {
-                    match field.node.pat.node {
+                    match field.pat.node {
                         PatKind::Wild => {},
                         _ => {
                             if let Ok(n) = cx.sess().source_map().span_to_snippet(field.span) {
@@ -262,7 +262,7 @@ fn check_pat(&mut self, cx: &EarlyContext<'_>, pat: &Pat) {
                     }
                 }
                 for field in pfields {
-                    if let PatKind::Wild = field.node.pat.node {
+                    if let PatKind::Wild = field.pat.node {
                         wilds -= 1;
                         if wilds > 0 {
                             span_lint(
index a8c45166a8b35de0947944afee8c4c6f0feb2224..fc614b08a1f5c001d2f216516ea1c1b363ed81e0 100644 (file)
@@ -131,8 +131,8 @@ fn visit_pat(&mut self, pat: &'tcx Pat) {
             PatKind::Ident(_, ident, _) => self.check_ident(ident),
             PatKind::Struct(_, ref fields, _) => {
                 for field in fields {
-                    if !field.node.is_shorthand {
-                        self.visit_pat(&field.node.pat);
+                    if !field.is_shorthand {
+                        self.visit_pat(&field.pat);
                     }
                 }
             },
index 0e75f85cccbc8731efe8d3e696e3a41a5f2da495..b30f8d415b18f61642755e50e90dbac07e851db4 100644 (file)
@@ -190,20 +190,20 @@ fn check_pat<'a, 'tcx>(
             if let Some(init_struct) = init {
                 if let ExprKind::Struct(_, ref efields, _) = init_struct.node {
                     for field in pfields {
-                        let name = field.node.ident.name;
+                        let name = field.ident.name;
                         let efield = efields
                             .iter()
                             .find_map(|f| if f.ident.name == name { Some(&*f.expr) } else { None });
-                        check_pat(cx, &field.node.pat, efield, span, bindings);
+                        check_pat(cx, &field.pat, efield, span, bindings);
                     }
                 } else {
                     for field in pfields {
-                        check_pat(cx, &field.node.pat, init, span, bindings);
+                        check_pat(cx, &field.pat, init, span, bindings);
                     }
                 }
             } else {
                 for field in pfields {
-                    check_pat(cx, &field.node.pat, None, span, bindings);
+                    check_pat(cx, &field.pat, None, span, bindings);
                 }
             }
         },
index 809590c88bf57093080c196f861dbc8957e776a4..309b5165c69e1b1c26016b73a9151e11bbb0ac94 100644 (file)
@@ -420,11 +420,11 @@ fn print_pat(cx: &LateContext<'_, '_>, pat: &hir::Pat, indent: usize) {
             println!("{}ignore leftover fields: {}", ind, ignore);
             println!("{}fields:", ind);
             for field in fields {
-                println!("{}  field name: {}", ind, field.node.ident.name);
-                if field.node.is_shorthand {
+                println!("{}  field name: {}", ind, field.ident.name);
+                if field.is_shorthand {
                     println!("{}  in shorthand notation", ind);
                 }
-                print_pat(cx, &field.node.pat, indent + 1);
+                print_pat(cx, &field.pat, indent + 1);
             }
         },
         hir::PatKind::TupleStruct(ref path, ref fields, opt_dots_position) => {
index 9e45c453ae9f89716bba7255684f73be9b614059..9981799ed1d5d51332e71dd64aa4b36c4306911b 100644 (file)
@@ -783,7 +783,7 @@ fn are_refutable<'a, I: Iterator<Item = &'a Pat>>(cx: &LateContext<'_, '_>, mut
             if is_enum_variant(cx, qpath, pat.hir_id) {
                 true
             } else {
-                are_refutable(cx, fields.iter().map(|field| &*field.node.pat))
+                are_refutable(cx, fields.iter().map(|field| &*field.pat))
             }
         },
         PatKind::TupleStruct(ref qpath, ref pats, _) => {
index 3608c0e61251a594cf45575a9793d6de43f61f8d..bcf688c1914c39caaae627a6190ecc8cb04196c0 100644 (file)
 
 impl EarlyLintPass for Write {
     fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &Mac) {
-        if mac.node.path == sym!(println) {
+        if mac.path == sym!(println) {
             span_lint(cx, PRINT_STDOUT, mac.span, "use of `println!`");
-            if let (Some(fmt_str), _) = check_tts(cx, &mac.node.tts, false) {
+            if let (Some(fmt_str), _) = check_tts(cx, &mac.tts, false) {
                 if fmt_str.contents.is_empty() {
                     span_lint_and_sugg(
                         cx,
@@ -198,9 +198,9 @@ fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &Mac) {
                     );
                 }
             }
-        } else if mac.node.path == sym!(print) {
+        } else if mac.path == sym!(print) {
             span_lint(cx, PRINT_STDOUT, mac.span, "use of `print!`");
-            if let (Some(fmt_str), _) = check_tts(cx, &mac.node.tts, false) {
+            if let (Some(fmt_str), _) = check_tts(cx, &mac.tts, false) {
                 if check_newlines(&fmt_str) {
                     span_lint_and_then(
                         cx,
@@ -211,7 +211,7 @@ fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &Mac) {
                             err.multipart_suggestion(
                                 "use `println!` instead",
                                 vec![
-                                    (mac.node.path.span, String::from("println")),
+                                    (mac.path.span, String::from("println")),
                                     (fmt_str.newline_span(), String::new()),
                                 ],
                                 Applicability::MachineApplicable,
@@ -220,8 +220,8 @@ fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &Mac) {
                     );
                 }
             }
-        } else if mac.node.path == sym!(write) {
-            if let (Some(fmt_str), _) = check_tts(cx, &mac.node.tts, true) {
+        } else if mac.path == sym!(write) {
+            if let (Some(fmt_str), _) = check_tts(cx, &mac.tts, true) {
                 if check_newlines(&fmt_str) {
                     span_lint_and_then(
                         cx,
@@ -232,7 +232,7 @@ fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &Mac) {
                             err.multipart_suggestion(
                                 "use `writeln!()` instead",
                                 vec![
-                                    (mac.node.path.span, String::from("writeln")),
+                                    (mac.path.span, String::from("writeln")),
                                     (fmt_str.newline_span(), String::new()),
                                 ],
                                 Applicability::MachineApplicable,
@@ -241,8 +241,8 @@ fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &Mac) {
                     )
                 }
             }
-        } else if mac.node.path == sym!(writeln) {
-            if let (Some(fmt_str), expr) = check_tts(cx, &mac.node.tts, true) {
+        } else if mac.path == sym!(writeln) {
+            if let (Some(fmt_str), expr) = check_tts(cx, &mac.tts, true) {
                 if fmt_str.contents.is_empty() {
                     let mut applicability = Applicability::MachineApplicable;
                     let suggestion = expr.map_or_else(