Skip to content

Commit

Permalink
Make exhaustive_enums a late pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Jan 21, 2021
1 parent f1ab302 commit dc93188
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions clippy_lints/src/exhaustive_enums.rs
@@ -1,8 +1,8 @@
use crate::utils::{snippet_opt, span_lint_and_help, span_lint_and_sugg};
use if_chain::if_chain;
use rustc_ast::ast::{Item, ItemKind};
use rustc_hir::{Item, ItemKind};
use rustc_errors::Applicability;
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::sym;

Expand Down Expand Up @@ -36,8 +36,8 @@ declare_clippy_lint! {

declare_lint_pass!(ExhaustiveEnums => [EXHAUSTIVE_ENUMS]);

impl EarlyLintPass for ExhaustiveEnums {
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
impl LateLintPass<'_> for ExhaustiveEnums {
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
if_chain! {
if let ItemKind::Enum(..) = item.kind;
if !item.attrs.iter().any(|a| a.has_name(sym::non_exhaustive));
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/lib.rs
Expand Up @@ -1098,7 +1098,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
store.register_late_pass(|| box eval_order_dependence::EvalOrderDependence);
store.register_late_pass(|| box missing_doc::MissingDoc::new());
store.register_late_pass(|| box missing_inline::MissingInline);
store.register_early_pass(move || box exhaustive_enums::ExhaustiveEnums);
store.register_late_pass(move || box exhaustive_enums::ExhaustiveEnums);
store.register_late_pass(|| box if_let_some_result::OkIfLet);
store.register_late_pass(|| box partialeq_ne_impl::PartialEqNeImpl);
store.register_late_pass(|| box unused_io_amount::UnusedIoAmount);
Expand Down

0 comments on commit dc93188

Please sign in to comment.