about summary refs log tree commit diff
path: root/clippy_dev/src/lib.rs
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2024-11-28 19:38:59 +0100
committerPhilipp Krones <hello@philkrones.com>2024-11-28 19:38:59 +0100
commitd58b911e0170c6a06859dd70619b4d991a32e4d4 (patch)
tree3fabc1f7c2aa609c1369fbff0e0d5ed8500f9aba /clippy_dev/src/lib.rs
parentb73a71c6b4c31d303bf542066b79baad6f2a276a (diff)
downloadrust-d58b911e0170c6a06859dd70619b4d991a32e4d4.tar.gz
rust-d58b911e0170c6a06859dd70619b4d991a32e4d4.zip
Merge commit 'ff4a26d442bead94a4c96fb1de967374bc4fbd8e' into clippy-subtree-update
Diffstat (limited to 'clippy_dev/src/lib.rs')
-rw-r--r--clippy_dev/src/lib.rs62
1 files changed, 3 insertions, 59 deletions
diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs
index ad385d5fbd2..9280369c23b 100644
--- a/clippy_dev/src/lib.rs
+++ b/clippy_dev/src/lib.rs
@@ -14,69 +14,13 @@
 extern crate rustc_driver;
 extern crate rustc_lexer;
 
-use std::io;
-use std::path::PathBuf;
-use std::process::{self, ExitStatus};
-
 pub mod dogfood;
 pub mod fmt;
 pub mod lint;
 pub mod new_lint;
+pub mod release;
 pub mod serve;
 pub mod setup;
+pub mod sync;
 pub mod update_lints;
-
-#[cfg(not(windows))]
-static CARGO_CLIPPY_EXE: &str = "cargo-clippy";
-#[cfg(windows)]
-static CARGO_CLIPPY_EXE: &str = "cargo-clippy.exe";
-
-/// Returns the path to the `cargo-clippy` binary
-///
-/// # Panics
-///
-/// Panics if the path of current executable could not be retrieved.
-#[must_use]
-pub fn cargo_clippy_path() -> PathBuf {
-    let mut path = std::env::current_exe().expect("failed to get current executable name");
-    path.set_file_name(CARGO_CLIPPY_EXE);
-    path
-}
-
-/// Returns the path to the Clippy project directory
-///
-/// # Panics
-///
-/// Panics if the current directory could not be retrieved, there was an error reading any of the
-/// Cargo.toml files or ancestor directory is the clippy root directory
-#[must_use]
-pub fn clippy_project_root() -> PathBuf {
-    let current_dir = std::env::current_dir().unwrap();
-    for path in current_dir.ancestors() {
-        let result = std::fs::read_to_string(path.join("Cargo.toml"));
-        if let Err(err) = &result {
-            if err.kind() == io::ErrorKind::NotFound {
-                continue;
-            }
-        }
-
-        let content = result.unwrap();
-        if content.contains("[package]\nname = \"clippy\"") {
-            return path.to_path_buf();
-        }
-    }
-    panic!("error: Can't determine root of project. Please run inside a Clippy working dir.");
-}
-
-/// # Panics
-/// Panics if given command result was failed.
-pub fn exit_if_err(status: io::Result<ExitStatus>) {
-    match status.expect("failed to run command").code() {
-        Some(0) => {},
-        Some(n) => process::exit(n),
-        None => {
-            eprintln!("Killed by signal");
-            process::exit(1);
-        },
-    }
-}
+pub mod utils;