Skip to content

Commit

Permalink
register all group
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
  • Loading branch information
BugenZhao committed Jan 22, 2024
1 parent aa812de commit 5ab5508
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,25 @@ dylint_linting::dylint_library!();
#[allow(clippy::no_mangle_with_rust_abi)]
#[no_mangle]
pub fn register_lints(_sess: &rustc_session::Session, lint_store: &mut rustc_lint::LintStore) {
// -- Begin lint registration --

// Preparation steps.
lint_store.register_early_pass(|| {
Box::<utils::format_args_collector::FormatArgsCollector>::default()
});

// Actual lints.
lint_store.register_lints(&[format_error::FORMAT_ERROR]);
lint_store.register_late_pass(|_| Box::<format_error::FormatError>::default());

// -- End lint registration --

// Register all lints in the `rw::all` group.
let all_lints = lint_store
.get_lints()
.iter()
.filter(|l| l.name.starts_with("rw::"))
.map(|l| rustc_lint::LintId::of(l))
.collect();
lint_store.register_group(true, "rw::all", None, all_lints);
}

0 comments on commit 5ab5508

Please sign in to comment.