diff options
author | Alexandru Macovei <alexnmaco@gmail.com> | 2021-01-20 20:34:18 +0200 |
---|---|---|
committer | Matan Kushner <hello@matchai.dev> | 2021-01-22 11:50:12 -0500 |
commit | 499e0357b0c1badb93334f6dbfb94a94120f723d (patch) | |
tree | 4ac694a9b8ae6b1fc00950e601b0120cfb187df2 | |
parent | c8a80869306782a85dab3eea2b7cc91dfd000fc9 (diff) |
refactor: apply more clippy lints
-rw-r--r-- | src/context.rs | 10 | ||||
-rw-r--r-- | src/modules/package.rs | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/context.rs b/src/context.rs index 8a362768a..7b0986bf6 100644 --- a/src/context.rs +++ b/src/context.rs @@ -231,7 +231,7 @@ pub struct DirContents { impl DirContents { #[cfg(test)] - fn from_path(base: &PathBuf) -> Result<Self, std::io::Error> { + fn from_path(base: &Path) -> Result<Self, std::io::Error> { Self::from_path_with_timeout(base, Duration::from_secs(30)) } @@ -448,7 +448,7 @@ mod tests { #[test] fn test_scan_dir() -> Result<(), Box<dyn std::error::Error>> { let empty = testdir(&[])?; - let empty_dc = DirContents::from_path(&PathBuf::from(empty.path()))?; + let empty_dc = DirContents::from_path(empty.path())?; assert_eq!( ScanDir { @@ -463,7 +463,7 @@ mod tests { empty.close()?; let rust = testdir(&["README.md", "Cargo.toml", "src/main.rs"])?; - let rust_dc = DirContents::from_path(&PathBuf::from(rust.path()))?; + let rust_dc = DirContents::from_path(rust.path())?; assert_eq!( ScanDir { dir_contents: &rust_dc, @@ -477,7 +477,7 @@ mod tests { rust.close()?; let java = testdir(&["README.md", "src/com/test/Main.java", "pom.xml"])?; - let java_dc = DirContents::from_path(&PathBuf::from(java.path()))?; + let java_dc = DirContents::from_path(java.path())?; assert_eq!( ScanDir { dir_contents: &java_dc, @@ -491,7 +491,7 @@ mod tests { java.close()?; let node = testdir(&["README.md", "node_modules/lodash/main.js", "package.json"])?; - let node_dc = DirContents::from_path(&PathBuf::from(node.path()))?; + let node_dc = DirContents::from_path(node.path())?; assert_eq!( ScanDir { dir_contents: &node_dc, diff --git a/src/modules/package.rs b/src/modules/package.rs index e039e4601..9c412f83c 100644 --- a/src/modules/package.rs +++ b/src/modules/package.rs @@ -757,7 +757,7 @@ end"; } fn create_project_dir() -> io::Result<TempDir> { - Ok(tempfile::tempdir()?) + tempfile::tempdir() } fn fill_config( |