]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/excessive_bools.rs
Rollup merge of #83092 - petrochenkov:qspan, r=estebank
[rust.git] / clippy_lints / src / excessive_bools.rs
index aa91ab3bc774c997e9a3b1a98b0d2dcc669f74e7..6f22f65deac80ec183d003c4b7ac0ebeb1f581df 100644 (file)
@@ -1,8 +1,10 @@
 use crate::utils::{attr_by_name, in_macro, match_path_ast, span_lint_and_help};
+use rustc_ast::ast::{
+    AssocItemKind, Extern, FnKind, FnSig, ImplKind, Item, ItemKind, TraitKind, Ty, TyKind,
+};
 use rustc_lint::{EarlyContext, EarlyLintPass};
 use rustc_session::{declare_tool_lint, impl_lint_pass};
 use rustc_span::Span;
-use syntax::ast::{AssocItemKind, Extern, FnSig, Item, ItemKind, Ty, TyKind};
 
 use std::convert::TryInto;
 
@@ -114,6 +116,7 @@ fn check_fn_sig(&self, cx: &EarlyContext<'_>, fn_sig: &FnSig, span: Span) {
                 FN_PARAMS_EXCESSIVE_BOOLS,
                 span,
                 &format!("more than {} bools in function parameters", self.max_fn_params_bools),
+                None,
                 "consider refactoring bools into two-variant enums",
             );
         }
@@ -153,21 +156,22 @@ fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
                         STRUCT_EXCESSIVE_BOOLS,
                         item.span,
                         &format!("more than {} bools in a struct", self.max_struct_bools),
+                        None,
                         "consider using a state machine or refactoring bools into two-variant enums",
                     );
                 }
             },
-            ItemKind::Impl {
+            ItemKind::Impl(box ImplKind {
                 of_trait: None, items, ..
-            }
-            | ItemKind::Trait(_, _, _, _, items) => {
+            })
+            | ItemKind::Trait(box TraitKind(.., items)) => {
                 for item in items {
-                    if let AssocItemKind::Fn(fn_sig, _, _) = &item.kind {
+                    if let AssocItemKind::Fn(box FnKind(_, fn_sig, _, _)) = &item.kind {
                         self.check_fn_sig(cx, fn_sig, item.span);
                     }
                 }
             },
-            ItemKind::Fn(fn_sig, _, _) => self.check_fn_sig(cx, fn_sig, item.span),
+            ItemKind::Fn(box FnKind(_, fn_sig, _, _)) => self.check_fn_sig(cx, fn_sig, item.span),
             _ => (),
         }
     }