about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCameron Steffen <cam.steffen94@gmail.com>2021-08-23 10:58:56 -0500
committerCameron Steffen <cam.steffen94@gmail.com>2021-08-23 11:02:03 -0500
commit68b4a43e23d9c7e847e71cdbfa9d915df4997e38 (patch)
treec93465ee312061058ba32f08f505edc647044fe5
parent22606e7358845eb8ddbc37243e89914c03084afb (diff)
downloadrust-68b4a43e23d9c7e847e71cdbfa9d915df4997e38.tar.gz
rust-68b4a43e23d9c7e847e71cdbfa9d915df4997e38.zip
Remove stderr limit
-rw-r--r--.github/workflows/clippy_dev.yml3
-rw-r--r--clippy_dev/src/lib.rs1
-rw-r--r--clippy_dev/src/main.rs9
-rw-r--r--clippy_dev/src/stderr_length_check.rs51
4 files changed, 1 insertions, 63 deletions
diff --git a/.github/workflows/clippy_dev.yml b/.github/workflows/clippy_dev.yml
index 95da775b7bc..9a5416153ab 100644
--- a/.github/workflows/clippy_dev.yml
+++ b/.github/workflows/clippy_dev.yml
@@ -42,9 +42,6 @@ jobs:
       run: cargo build --features deny-warnings
       working-directory: clippy_dev
 
-    - name: Test limit_stderr_length
-      run: cargo dev limit_stderr_length
-
     - name: Test update_lints
       run: cargo dev update_lints --check
 
diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs
index 72bdaf8d592..e05db7af586 100644
--- a/clippy_dev/src/lib.rs
+++ b/clippy_dev/src/lib.rs
@@ -17,7 +17,6 @@ pub mod fmt;
 pub mod new_lint;
 pub mod serve;
 pub mod setup;
-pub mod stderr_length_check;
 pub mod update_lints;
 
 static DEC_CLIPPY_LINT_RE: SyncLazy<Regex> = SyncLazy::new(|| {
diff --git a/clippy_dev/src/main.rs b/clippy_dev/src/main.rs
index ff324ff6ee6..8fdeba9842a 100644
--- a/clippy_dev/src/main.rs
+++ b/clippy_dev/src/main.rs
@@ -3,7 +3,7 @@
 #![warn(rust_2018_idioms, unused_lifetimes)]
 
 use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
-use clippy_dev::{bless, fmt, new_lint, serve, setup, stderr_length_check, update_lints};
+use clippy_dev::{bless, fmt, new_lint, serve, setup, update_lints};
 fn main() {
     let matches = get_clap_config();
 
@@ -33,9 +33,6 @@ fn main() {
                 Err(e) => eprintln!("Unable to create lint: {}", e),
             }
         },
-        ("limit_stderr_length", _) => {
-            stderr_length_check::check();
-        },
         ("setup", Some(sub_command)) => match sub_command.subcommand() {
             ("intellij", Some(matches)) => setup::intellij::setup_rustc_src(
                 matches
@@ -153,10 +150,6 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
                 ),
         )
         .subcommand(
-            SubCommand::with_name("limit_stderr_length")
-                .about("Ensures that stderr files do not grow longer than a certain amount of lines."),
-        )
-        .subcommand(
             SubCommand::with_name("setup")
                 .about("Support for setting up your personal development environment")
                 .setting(AppSettings::ArgRequiredElseHelp)
diff --git a/clippy_dev/src/stderr_length_check.rs b/clippy_dev/src/stderr_length_check.rs
deleted file mode 100644
index e02b6f7da5f..00000000000
--- a/clippy_dev/src/stderr_length_check.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-use crate::clippy_project_root;
-use std::ffi::OsStr;
-use std::fs;
-use std::path::{Path, PathBuf};
-use walkdir::WalkDir;
-
-// The maximum length allowed for stderr files.
-//
-// We limit this because small files are easier to deal with than bigger files.
-const LENGTH_LIMIT: usize = 200;
-
-pub fn check() {
-    let exceeding_files: Vec<_> = exceeding_stderr_files();
-
-    if !exceeding_files.is_empty() {
-        eprintln!("Error: stderr files exceeding limit of {} lines:", LENGTH_LIMIT);
-        for (path, count) in exceeding_files {
-            println!("{}: {}", path.display(), count);
-        }
-        std::process::exit(1);
-    }
-}
-
-fn exceeding_stderr_files() -> Vec<(PathBuf, usize)> {
-    // We use `WalkDir` instead of `fs::read_dir` here in order to recurse into subdirectories.
-    WalkDir::new(clippy_project_root().join("tests/ui"))
-        .into_iter()
-        .filter_map(Result::ok)
-        .filter(|f| !f.file_type().is_dir())
-        .filter_map(|e| {
-            let p = e.into_path();
-            let count = count_linenumbers(&p);
-            if p.extension() == Some(OsStr::new("stderr")) && count > LENGTH_LIMIT {
-                Some((p, count))
-            } else {
-                None
-            }
-        })
-        .collect()
-}
-
-#[must_use]
-fn count_linenumbers(filepath: &Path) -> usize {
-    match fs::read(filepath) {
-        Ok(content) => bytecount::count(&content, b'\n'),
-        Err(e) => {
-            eprintln!("Failed to read file: {}", e);
-            0
-        },
-    }
-}