Skip to content

Commit b118f89

Browse files
committed
Let update_lints also generate the internal lints
1 parent 0e73691 commit b118f89

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

clippy_dev/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ impl Lint {
6161
lints.filter(|l| l.deprecation.is_none() && !l.is_internal())
6262
}
6363

64+
/// Returns all internal lints (not `internal_warn` lints)
65+
pub fn internal_lints(lints: impl Iterator<Item = Self>) -> impl Iterator<Item = Self> {
66+
lints.filter(|l| l.group == "internal")
67+
}
68+
6469
/// Returns the lints in a `HashMap`, grouped by the different lint groups
6570
#[must_use]
6671
pub fn by_lint_group(lints: impl Iterator<Item = Self>) -> HashMap<String, Vec<Self>> {
@@ -81,7 +86,7 @@ pub fn gen_lint_group_list(lints: Vec<Lint>) -> Vec<String> {
8186
lints
8287
.into_iter()
8388
.filter_map(|l| {
84-
if l.is_internal() || l.deprecation.is_some() {
89+
if l.deprecation.is_some() {
8590
None
8691
} else {
8792
Some(format!(" LintId::of(&{}::{}),", l.module, l.name.to_uppercase()))

clippy_dev/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ fn print_lints() {
164164
fn update_lints(update_mode: UpdateMode) {
165165
let lint_list: Vec<Lint> = gather_all().collect();
166166

167+
let internal_lints = Lint::internal_lints(lint_list.clone().into_iter());
168+
167169
let usable_lints: Vec<Lint> = Lint::usable_lints(lint_list.clone().into_iter()).collect();
168170
let lint_count = usable_lints.len();
169171

@@ -267,7 +269,7 @@ fn update_lints(update_mode: UpdateMode) {
267269
.changed;
268270

269271
// Generate the list of lints for all other lint groups
270-
for (lint_group, lints) in Lint::by_lint_group(usable_lints.into_iter()) {
272+
for (lint_group, lints) in Lint::by_lint_group(usable_lints.into_iter().chain(internal_lints)) {
271273
file_change |= replace_region_in_file(
272274
Path::new("clippy_lints/src/lib.rs"),
273275
&format!("store.register_group\\(true, \"clippy::{}\"", lint_group),

clippy_lints/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,10 +1105,10 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11051105
store.register_group(true, "clippy::internal", Some("clippy_internal"), vec![
11061106
LintId::of(&utils::internal_lints::CLIPPY_LINTS_INTERNAL),
11071107
LintId::of(&utils::internal_lints::COMPILER_LINT_FUNCTIONS),
1108+
LintId::of(&utils::internal_lints::DEFAULT_LINT),
11081109
LintId::of(&utils::internal_lints::LINT_WITHOUT_LINT_PASS),
11091110
LintId::of(&utils::internal_lints::OUTER_EXPN_EXPN_DATA),
11101111
LintId::of(&utils::internal_lints::PRODUCE_ICE),
1111-
LintId::of(&utils::internal_lints::DEFAULT_LINT),
11121112
]);
11131113

11141114
store.register_group(true, "clippy::all", Some("clippy"), vec![

0 commit comments

Comments
 (0)