]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_dev/src/lib.rs
Detect match statement intended to be tail expression
[rust.git] / src / tools / clippy / clippy_dev / src / lib.rs
index 24d70d433f367e0072def9923508bb5a2b125c60..01d1fc9211a94fc2576f26786df87e64485824df 100644 (file)
@@ -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 @@ pub fn replace_region_in_file<F>(
 ///     .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 @@ pub fn replace_region_in_text<F>(text: &str, start: &str, end: &str, replace_sta
 }
 
 /// 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();