diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2021-02-02 20:43:30 -0800 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2021-02-02 20:43:30 -0800 |
| commit | c8cb90abbdff45cd936272903f14990bdcefc1cf (patch) | |
| tree | 69cad02118814662fdf4c17f69e6737088521f5f /clippy_dev/src/lib.rs | |
| parent | b56b751055a9c05e3bcbf1740865e2dc7f1ae872 (diff) | |
| download | rust-c8cb90abbdff45cd936272903f14990bdcefc1cf.tar.gz rust-c8cb90abbdff45cd936272903f14990bdcefc1cf.zip | |
Merge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-from-clippy
Diffstat (limited to 'clippy_dev/src/lib.rs')
| -rw-r--r-- | clippy_dev/src/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
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(); |
