From 499e0357b0c1badb93334f6dbfb94a94120f723d Mon Sep 17 00:00:00 2001 From: Alexandru Macovei Date: Wed, 20 Jan 2021 20:34:18 +0200 Subject: [PATCH] refactor: apply more clippy lints --- src/context.rs | 10 +++++----- src/modules/package.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/context.rs b/src/context.rs index 8a362768..7b0986bf 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 { + fn from_path(base: &Path) -> Result { Self::from_path_with_timeout(base, Duration::from_secs(30)) } @@ -448,7 +448,7 @@ mod tests { #[test] fn test_scan_dir() -> Result<(), Box> { 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 e039e460..9c412f83 100644 --- a/src/modules/package.rs +++ b/src/modules/package.rs @@ -757,7 +757,7 @@ end"; } fn create_project_dir() -> io::Result { - Ok(tempfile::tempdir()?) + tempfile::tempdir() } fn fill_config(