about summary refs log tree commit diff
path: root/clippy_dev
diff options
context:
space:
mode:
authorflip1995 <hello@philkrones.com>2020-02-11 11:11:43 +0100
committerflip1995 <hello@philkrones.com>2020-02-14 14:37:56 +0100
commit4a9bfe41841ad7299174832cbad450625ef5fc58 (patch)
tree74eaf06d6f6297c6b6a0e559e42b417f9d9d7ff7 /clippy_dev
parent3da2c9183a19c6f11e8bd61f16d03b6830eb3eec (diff)
downloadrust-4a9bfe41841ad7299174832cbad450625ef5fc58.tar.gz
rust-4a9bfe41841ad7299174832cbad450625ef5fc58.zip
Let update_lints also generate the internal lints
Diffstat (limited to 'clippy_dev')
-rw-r--r--clippy_dev/src/lib.rs7
-rw-r--r--clippy_dev/src/main.rs4
2 files changed, 9 insertions, 2 deletions
diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs
index 042ce9bc009..8e6479b64c4 100644
--- a/clippy_dev/src/lib.rs
+++ b/clippy_dev/src/lib.rs
@@ -61,6 +61,11 @@ impl Lint {
         lints.filter(|l| l.deprecation.is_none() && !l.is_internal())
     }
 
+    /// Returns all internal lints (not `internal_warn` lints)
+    pub fn internal_lints(lints: impl Iterator<Item = Self>) -> impl Iterator<Item = Self> {
+        lints.filter(|l| l.group == "internal")
+    }
+
     /// Returns the lints in a `HashMap`, grouped by the different lint groups
     #[must_use]
     pub fn by_lint_group(lints: impl Iterator<Item = Self>) -> HashMap<String, Vec<Self>> {
@@ -79,7 +84,7 @@ pub fn gen_lint_group_list(lints: Vec<Lint>) -> Vec<String> {
     lints
         .into_iter()
         .filter_map(|l| {
-            if l.is_internal() || l.deprecation.is_some() {
+            if l.deprecation.is_some() {
                 None
             } else {
                 Some(format!("        LintId::of(&{}::{}),", l.module, l.name.to_uppercase()))
diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs
index 2808aafc690..c2c9112e3b8 100644
--- a/clippy_dev/src/main.rs
+++ b/clippy_dev/src/main.rs
@@ -164,6 +164,8 @@ fn print_lints() {
 fn update_lints(update_mode: UpdateMode) {
     let lint_list: Vec<Lint> = gather_all().collect();
 
+    let internal_lints = Lint::internal_lints(lint_list.clone().into_iter());
+
     let usable_lints: Vec<Lint> = Lint::usable_lints(lint_list.clone().into_iter()).collect();
     let lint_count = usable_lints.len();
 
@@ -267,7 +269,7 @@ fn update_lints(update_mode: UpdateMode) {
     .changed;
 
     // Generate the list of lints for all other lint groups
-    for (lint_group, lints) in Lint::by_lint_group(usable_lints.into_iter()) {
+    for (lint_group, lints) in Lint::by_lint_group(usable_lints.into_iter().chain(internal_lints)) {
         file_change |= replace_region_in_file(
             Path::new("clippy_lints/src/lib.rs"),
             &format!("store.register_group\\(true, \"clippy::{}\"", lint_group),