about summary refs log tree commit diff
path: root/clippy_dev/src/lib.rs
diff options
context:
space:
mode:
authorCaden Haustein <code@brightlysalty.33mail.com>2020-12-30 16:37:59 -0600
committerflip1995 <philipp.krones@embecosm.com>2021-02-02 16:36:32 +0100
commitbde667af7e7d512978daff3bc2b540bb913bd6a1 (patch)
tree6b66300b6471c6cbacd87cdbe82e33a42d557be4 /clippy_dev/src/lib.rs
parentf870876d925b5dd115c9d792783dc6208e33d913 (diff)
downloadrust-bde667af7e7d512978daff3bc2b540bb913bd6a1.tar.gz
rust-bde667af7e7d512978daff3bc2b540bb913bd6a1.zip
Add missing_panics_doc lint
Diffstat (limited to 'clippy_dev/src/lib.rs')
-rw-r--r--clippy_dev/src/lib.rs13
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();