Skip to content

Commit da67982

Browse files
committed
Get rid of Lint::is_internal method
1 parent ffb2e41 commit da67982

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

clippy_dev/src/lib.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl Lint {
6363

6464
/// Returns all non-deprecated lints and non-internal lints
6565
pub fn usable_lints(lints: impl Iterator<Item = Self>) -> impl Iterator<Item = Self> {
66-
lints.filter(|l| l.deprecation.is_none() && !l.is_internal())
66+
lints.filter(|l| l.deprecation.is_none() && !l.group.starts_with("internal"))
6767
}
6868

6969
/// Returns all internal lints (not `internal_warn` lints)
@@ -76,11 +76,6 @@ impl Lint {
7676
pub fn by_lint_group(lints: impl Iterator<Item = Self>) -> HashMap<String, Vec<Self>> {
7777
lints.map(|lint| (lint.group.to_string(), lint)).into_group_map()
7878
}
79-
80-
#[must_use]
81-
pub fn is_internal(&self) -> bool {
82-
self.group.starts_with("internal")
83-
}
8479
}
8580

8681
/// 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> {
10398
#[must_use]
10499
pub fn gen_modules_list(lints: &[Lint]) -> Vec<String> {
105100
lints
106-
.into_iter()
107-
.filter_map(|l| {
108-
if l.is_internal() || l.deprecation.is_some() {
109-
None
110-
} else {
111-
Some(l.module.clone())
112-
}
113-
})
101+
.iter()
102+
.map(|l| &l.module)
114103
.unique()
115104
.map(|module| format!("pub mod {};", module))
116105
.sorted()
@@ -124,7 +113,7 @@ pub fn gen_changelog_lint_list(lints: &[Lint]) -> Vec<String> {
124113
.iter()
125114
.sorted_by_key(|l| l.name.clone())
126115
.filter_map(|l| {
127-
if l.is_internal() {
116+
if l.group.starts_with("internal") {
128117
None
129118
} else {
130119
Some(format!("[`{}`]: {}#{}", l.name, DOCS_LINK, l.name))
@@ -158,13 +147,7 @@ pub fn gen_register_lint_list(lints: &[Lint]) -> Vec<String> {
158147
let post = " ]);".to_string();
159148
let mut inner = lints
160149
.iter()
161-
.filter_map(|l| {
162-
if !l.is_internal() && l.deprecation.is_none() {
163-
Some(format!(" &{}::{},", l.module, l.name.to_uppercase()))
164-
} else {
165-
None
166-
}
167-
})
150+
.map(|l| format!(" &{}::{},", l.module, l.name.to_uppercase()))
168151
.sorted()
169152
.collect::<Vec<String>>();
170153
inner.insert(0, pre);

clippy_dev/src/update_lints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn run(update_mode: UpdateMode) {
8181
"end register lints",
8282
false,
8383
update_mode == UpdateMode::Change,
84-
|| gen_register_lint_list(&lint_list),
84+
|| gen_register_lint_list(&usable_lints),
8585
)
8686
.changed;
8787

@@ -91,7 +91,7 @@ pub fn run(update_mode: UpdateMode) {
9191
"end lints modules",
9292
false,
9393
update_mode == UpdateMode::Change,
94-
|| gen_modules_list(&lint_list),
94+
|| gen_modules_list(&usable_lints),
9595
)
9696
.changed;
9797

0 commit comments

Comments
 (0)