mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
Get rid of Lint::is_internal method
This commit is contained in:
parent
ffb2e41234
commit
da679825e0
2 changed files with 7 additions and 24 deletions
|
@ -63,7 +63,7 @@ impl Lint {
|
||||||
|
|
||||||
/// Returns all non-deprecated lints and non-internal lints
|
/// Returns all non-deprecated lints and non-internal lints
|
||||||
pub fn usable_lints(lints: impl Iterator<Item = Self>) -> impl Iterator<Item = Self> {
|
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)
|
/// 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>> {
|
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()
|
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`.
|
/// 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]
|
#[must_use]
|
||||||
pub fn gen_modules_list(lints: &[Lint]) -> Vec<String> {
|
pub fn gen_modules_list(lints: &[Lint]) -> Vec<String> {
|
||||||
lints
|
lints
|
||||||
.into_iter()
|
.iter()
|
||||||
.filter_map(|l| {
|
.map(|l| &l.module)
|
||||||
if l.is_internal() || l.deprecation.is_some() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(l.module.clone())
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.unique()
|
.unique()
|
||||||
.map(|module| format!("pub mod {};", module))
|
.map(|module| format!("pub mod {};", module))
|
||||||
.sorted()
|
.sorted()
|
||||||
|
@ -124,7 +113,7 @@ pub fn gen_changelog_lint_list(lints: &[Lint]) -> Vec<String> {
|
||||||
.iter()
|
.iter()
|
||||||
.sorted_by_key(|l| l.name.clone())
|
.sorted_by_key(|l| l.name.clone())
|
||||||
.filter_map(|l| {
|
.filter_map(|l| {
|
||||||
if l.is_internal() {
|
if l.group.starts_with("internal") {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(format!("[`{}`]: {}#{}", l.name, DOCS_LINK, l.name))
|
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 post = " ]);".to_string();
|
||||||
let mut inner = lints
|
let mut inner = lints
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|l| {
|
.map(|l| format!(" &{}::{},", l.module, l.name.to_uppercase()))
|
||||||
if !l.is_internal() && l.deprecation.is_none() {
|
|
||||||
Some(format!(" &{}::{},", l.module, l.name.to_uppercase()))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.sorted()
|
.sorted()
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
inner.insert(0, pre);
|
inner.insert(0, pre);
|
||||||
|
|
|
@ -81,7 +81,7 @@ pub fn run(update_mode: UpdateMode) {
|
||||||
"end register lints",
|
"end register lints",
|
||||||
false,
|
false,
|
||||||
update_mode == UpdateMode::Change,
|
update_mode == UpdateMode::Change,
|
||||||
|| gen_register_lint_list(&lint_list),
|
|| gen_register_lint_list(&usable_lints),
|
||||||
)
|
)
|
||||||
.changed;
|
.changed;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ pub fn run(update_mode: UpdateMode) {
|
||||||
"end lints modules",
|
"end lints modules",
|
||||||
false,
|
false,
|
||||||
update_mode == UpdateMode::Change,
|
update_mode == UpdateMode::Change,
|
||||||
|| gen_modules_list(&lint_list),
|
|| gen_modules_list(&usable_lints),
|
||||||
)
|
)
|
||||||
.changed;
|
.changed;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue