refactor: apply more clippy lints

This commit is contained in:
Alexandru Macovei 2021-01-20 20:34:18 +02:00 committed by Matan Kushner
parent c8a8086930
commit 499e0357b0
2 changed files with 6 additions and 6 deletions

View File

@ -231,7 +231,7 @@ pub struct DirContents {
impl DirContents { impl DirContents {
#[cfg(test)] #[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)) Self::from_path_with_timeout(base, Duration::from_secs(30))
} }
@ -448,7 +448,7 @@ mod tests {
#[test] #[test]
fn test_scan_dir() -> Result<(), Box<dyn std::error::Error>> { fn test_scan_dir() -> Result<(), Box<dyn std::error::Error>> {
let empty = testdir(&[])?; let empty = testdir(&[])?;
let empty_dc = DirContents::from_path(&PathBuf::from(empty.path()))?; let empty_dc = DirContents::from_path(empty.path())?;
assert_eq!( assert_eq!(
ScanDir { ScanDir {
@ -463,7 +463,7 @@ mod tests {
empty.close()?; empty.close()?;
let rust = testdir(&["README.md", "Cargo.toml", "src/main.rs"])?; 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!( assert_eq!(
ScanDir { ScanDir {
dir_contents: &rust_dc, dir_contents: &rust_dc,
@ -477,7 +477,7 @@ mod tests {
rust.close()?; rust.close()?;
let java = testdir(&["README.md", "src/com/test/Main.java", "pom.xml"])?; 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!( assert_eq!(
ScanDir { ScanDir {
dir_contents: &java_dc, dir_contents: &java_dc,
@ -491,7 +491,7 @@ mod tests {
java.close()?; java.close()?;
let node = testdir(&["README.md", "node_modules/lodash/main.js", "package.json"])?; 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!( assert_eq!(
ScanDir { ScanDir {
dir_contents: &node_dc, dir_contents: &node_dc,

View File

@ -757,7 +757,7 @@ end";
} }
fn create_project_dir() -> io::Result<TempDir> { fn create_project_dir() -> io::Result<TempDir> {
Ok(tempfile::tempdir()?) tempfile::tempdir()
} }
fn fill_config( fn fill_config(