diff options
| author | Caden Haustein <code@brightlysalty.33mail.com> | 2020-12-30 16:37:59 -0600 |
|---|---|---|
| committer | flip1995 <philipp.krones@embecosm.com> | 2021-02-02 16:36:32 +0100 |
| commit | bde667af7e7d512978daff3bc2b540bb913bd6a1 (patch) | |
| tree | 6b66300b6471c6cbacd87cdbe82e33a42d557be4 /clippy_dev/src | |
| parent | f870876d925b5dd115c9d792783dc6208e33d913 (diff) | |
| download | rust-bde667af7e7d512978daff3bc2b540bb913bd6a1.tar.gz rust-bde667af7e7d512978daff3bc2b540bb913bd6a1.zip | |
Add missing_panics_doc lint
Diffstat (limited to 'clippy_dev/src')
| -rw-r--r-- | clippy_dev/src/bless.rs | 3 | ||||
| -rw-r--r-- | clippy_dev/src/lib.rs | 13 | ||||
| -rw-r--r-- | clippy_dev/src/ra_setup.rs | 3 | ||||
| -rw-r--r-- | clippy_dev/src/serve.rs | 3 |
4 files changed, 22 insertions, 0 deletions
diff --git a/clippy_dev/src/bless.rs b/clippy_dev/src/bless.rs index b877806946c..2a869e9d449 100644 --- a/clippy_dev/src/bless.rs +++ b/clippy_dev/src/bless.rs @@ -24,6 +24,9 @@ static CLIPPY_BUILD_TIME: SyncLazy<Option<std::time::SystemTime>> = SyncLazy::ne fs::metadata(path).ok()?.modified().ok() }); +/// # Panics +/// +/// Panics if the path to a test file is broken pub fn bless(ignore_timestamp: bool) { let test_suite_dirs = [ clippy_project_root().join("tests").join("ui"), diff --git a/clippy_dev/src/lib.rs b/clippy_dev/src/lib.rs index 24d70d433f3..01d1fc9211a 100644 --- a/clippy_dev/src/lib.rs +++ b/clippy_dev/src/lib.rs @@ -236,6 +236,10 @@ pub struct FileChange { /// `path` is the relative path to the file on which you want to perform the replacement. /// /// See `replace_region_in_text` for documentation of the other options. +/// +/// # Panics +/// +/// Panics if the path could not read or then written pub fn replace_region_in_file<F>( path: &Path, start: &str, @@ -283,6 +287,10 @@ where /// .new_lines; /// assert_eq!("replace_start\na different\ntext\nreplace_end", result); /// ``` +/// +/// # Panics +/// +/// Panics if start or end is not valid regex pub fn replace_region_in_text<F>(text: &str, start: &str, end: &str, replace_start: bool, replacements: F) -> FileChange where F: FnOnce() -> Vec<String>, @@ -329,6 +337,11 @@ where } /// 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(); diff --git a/clippy_dev/src/ra_setup.rs b/clippy_dev/src/ra_setup.rs index a8a6a2cb1bd..a3c329b578b 100644 --- a/clippy_dev/src/ra_setup.rs +++ b/clippy_dev/src/ra_setup.rs @@ -8,6 +8,9 @@ use std::path::{Path, PathBuf}; // This allows rust analyzer to analyze rustc internals and show proper information inside clippy // code. See https://github.com/rust-analyzer/rust-analyzer/issues/3517 and https://github.com/rust-lang/rust-clippy/issues/5514 for details +/// # Panics +/// +/// Panics if `rustc_path` does not lead to a rustc repo or the files could not be read pub fn run(rustc_path: Option<&str>) { // we can unwrap here because the arg is required by clap let rustc_path = PathBuf::from(rustc_path.unwrap()); diff --git a/clippy_dev/src/serve.rs b/clippy_dev/src/serve.rs index a46c0e4d3f0..faa94859601 100644 --- a/clippy_dev/src/serve.rs +++ b/clippy_dev/src/serve.rs @@ -4,6 +4,9 @@ use std::process::Command; use std::thread; use std::time::{Duration, SystemTime}; +/// # Panics +/// +/// Panics if the python commands could not be spawned pub fn run(port: u16, lint: Option<&str>) -> ! { let mut url = Some(match lint { None => format!("http://localhost:{}", port), |
