diff options
| author | flip1995 <hello@philkrones.com> | 2020-04-02 18:31:32 +0200 |
|---|---|---|
| committer | flip1995 <hello@philkrones.com> | 2020-04-03 21:19:32 +0200 |
| commit | da679825e0d3b1dda22044b3ec9ec1612a4e26f0 (patch) | |
| tree | 14abba5514841267fb83b55610b6815263488ef9 | |
| parent | ffb2e4123458e50202c02e63b9e044583c0fe79a (diff) | |
| download | rust-da679825e0d3b1dda22044b3ec9ec1612a4e26f0.tar.gz rust-da679825e0d3b1dda22044b3ec9ec1612a4e26f0.zip | |
Get rid of Lint::is_internal method
| -rw-r--r-- | clippy_dev/src/lib.rs | 27 | ||||
| -rw-r--r-- | clippy_dev/src/update_lints.rs | 4 |
2 files changed, 7 insertions, 24 deletions
diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs index b01112539be..4531d9b39c0 100644 --- a/clippy_dev/src/lib.rs +++ b/clippy_dev/src/lib.rs @@ -63,7 +63,7 @@ impl Lint { /// Returns all non-deprecated lints and non-internal lints pub fn usable_lints(lints: impl Iterator<Item = Self>) -> impl Iterator<Item = Self> { - lints.filter(|l| l.deprecation.is_none() && !l.is_internal()) + lints.filter(|l| l.deprecation.is_none() && !l.group.starts_with("internal")) } /// Returns all internal lints (not `internal_warn` lints) @@ -76,11 +76,6 @@ impl Lint { pub fn by_lint_group(lints: impl Iterator<Item = Self>) -> HashMap<String, Vec<Self>> { lints.map(|lint| (lint.group.to_string(), lint)).into_group_map() } - - #[must_use] - pub fn is_internal(&self) -> bool { - self.group.starts_with("internal") - } } /// Generates the Vec items for `register_lint_group` calls in `clippy_lints/src/lib.rs`. @@ -103,14 +98,8 @@ pub fn gen_lint_group_list(lints: &[Lint]) -> Vec<String> { #[must_use] pub fn gen_modules_list(lints: &[Lint]) -> Vec<String> { lints - .into_iter() - .filter_map(|l| { - if l.is_internal() || l.deprecation.is_some() { - None - } else { - Some(l.module.clone()) - } - }) + .iter() + .map(|l| &l.module) .unique() .map(|module| format!("pub mod {};", module)) .sorted() @@ -124,7 +113,7 @@ pub fn gen_changelog_lint_list(lints: &[Lint]) -> Vec<String> { .iter() .sorted_by_key(|l| l.name.clone()) .filter_map(|l| { - if l.is_internal() { + if l.group.starts_with("internal") { None } else { Some(format!("[`{}`]: {}#{}", l.name, DOCS_LINK, l.name)) @@ -158,13 +147,7 @@ pub fn gen_register_lint_list(lints: &[Lint]) -> Vec<String> { let post = " ]);".to_string(); let mut inner = lints .iter() - .filter_map(|l| { - if !l.is_internal() && l.deprecation.is_none() { - Some(format!(" &{}::{},", l.module, l.name.to_uppercase())) - } else { - None - } - }) + .map(|l| format!(" &{}::{},", l.module, l.name.to_uppercase())) .sorted() .collect::<Vec<String>>(); inner.insert(0, pre); diff --git a/clippy_dev/src/update_lints.rs b/clippy_dev/src/update_lints.rs index d709e4892fe..be565700b01 100644 --- a/clippy_dev/src/update_lints.rs +++ b/clippy_dev/src/update_lints.rs @@ -81,7 +81,7 @@ pub fn run(update_mode: UpdateMode) { "end register lints", false, update_mode == UpdateMode::Change, - || gen_register_lint_list(&lint_list), + || gen_register_lint_list(&usable_lints), ) .changed; @@ -91,7 +91,7 @@ pub fn run(update_mode: UpdateMode) { "end lints modules", false, update_mode == UpdateMode::Change, - || gen_modules_list(&lint_list), + || gen_modules_list(&usable_lints), ) .changed; |
