diff --git a/compiler_tester/src/directories/matter_labs/mod.rs b/compiler_tester/src/directories/matter_labs/mod.rs index 6d3e5479..0afee5e8 100644 --- a/compiler_tester/src/directories/matter_labs/mod.rs +++ b/compiler_tester/src/directories/matter_labs/mod.rs @@ -36,36 +36,29 @@ impl Collection for MatterLabsDirectory { let entry = entry?; let path = entry.path(); let entry_type = entry.file_type().map_err(|error| { - anyhow::anyhow!( - "Failed to get the type of file `{}`: {}", - path.to_string_lossy(), - error - ) + anyhow::anyhow!("Failed to get the type of file {path:?}: {error}") })?; if entry_type.is_dir() { tests.extend(Self::read_all( _target, - &path, + path.as_path(), extension, summary.clone(), filters, )?); continue; } else if !entry_type.is_file() { - anyhow::bail!("Invalid type of file `{}`", path.to_string_lossy()); + anyhow::bail!("Invalid type of file {path:?}"); } if entry.file_name().to_string_lossy().starts_with('.') { continue; } - let file_extension = path.extension().ok_or_else(|| { - anyhow::anyhow!( - "Failed to get the extension of file `{}`", - path.to_string_lossy() - ) - })?; + let file_extension = path + .extension() + .ok_or_else(|| anyhow::anyhow!("Failed to get the extension of file {path:?}"))?; if file_extension != extension { continue; } diff --git a/compiler_tester/src/lib.rs b/compiler_tester/src/lib.rs index ff5c2a57..17ae4f87 100644 --- a/compiler_tester/src/lib.rs +++ b/compiler_tester/src/lib.rs @@ -18,7 +18,7 @@ pub(crate) mod utils; pub(crate) mod vm; pub(crate) mod workflow; -use std::path::Path; +use std::path::PathBuf; use std::sync::Arc; use std::sync::Mutex; @@ -281,7 +281,7 @@ impl CompilerTester { tests.extend(self.directory::( target, - Self::SOLIDITY_SIMPLE, + PathBuf::from(Self::SOLIDITY_SIMPLE), era_compiler_common::EXTENSION_SOLIDITY, match toolchain { Toolchain::IrLLVM => solidity_compiler.clone(), @@ -291,14 +291,14 @@ impl CompilerTester { if let era_compiler_common::Target::EraVM = target { tests.extend(self.directory::( target, - Self::VYPER_SIMPLE, + PathBuf::from(Self::VYPER_SIMPLE), era_compiler_common::EXTENSION_VYPER, vyper_compiler.clone(), )?); } tests.extend(self.directory::( target, - Self::YUL_SIMPLE, + PathBuf::from(Self::YUL_SIMPLE), era_compiler_common::EXTENSION_YUL, match toolchain { Toolchain::IrLLVM => yul_compiler.clone(), @@ -307,20 +307,20 @@ impl CompilerTester { )?); tests.extend(self.directory::( target, - Self::LLVM_SIMPLE, + PathBuf::from(Self::LLVM_SIMPLE), era_compiler_common::EXTENSION_LLVM_SOURCE, llvm_compiler, )?); tests.extend(self.directory::( target, - Self::ERAVM_SIMPLE, + PathBuf::from(Self::ERAVM_SIMPLE), era_compiler_common::EXTENSION_ERAVM_ASSEMBLY, eravm_compiler, )?); tests.extend(self.directory::( target, - Self::SOLIDITY_COMPLEX, + PathBuf::from(Self::SOLIDITY_COMPLEX), era_compiler_common::EXTENSION_JSON, match toolchain { Toolchain::IrLLVM => solidity_compiler.clone(), @@ -330,7 +330,7 @@ impl CompilerTester { if let era_compiler_common::Target::EraVM = target { tests.extend(self.directory::( target, - Self::VYPER_COMPLEX, + PathBuf::from(Self::VYPER_COMPLEX), era_compiler_common::EXTENSION_JSON, vyper_compiler.clone(), )?); @@ -338,10 +338,10 @@ impl CompilerTester { tests.extend(self.directory::( target, - match target { + PathBuf::from(match target { era_compiler_common::Target::EraVM => Self::SOLIDITY_ETHEREUM, era_compiler_common::Target::EVM => Self::SOLIDITY_ETHEREUM_UPSTREAM, - }, + }), era_compiler_common::EXTENSION_SOLIDITY, match toolchain { Toolchain::IrLLVM => solidity_compiler.clone(), @@ -351,7 +351,7 @@ impl CompilerTester { if let era_compiler_common::Target::EraVM = target { tests.extend(self.directory::( target, - Self::VYPER_ETHEREUM, + PathBuf::from(Self::VYPER_ETHEREUM), era_compiler_common::EXTENSION_VYPER, vyper_compiler, )?); @@ -366,7 +366,7 @@ impl CompilerTester { fn directory( &self, target: era_compiler_common::Target, - path: &str, + path: PathBuf, extension: &'static str, compiler: Arc, ) -> anyhow::Result> @@ -375,12 +375,12 @@ impl CompilerTester { { Ok(T::read_all( target, - Path::new(path), + path.as_path(), extension, self.summary.clone(), &self.filters, ) - .map_err(|error| anyhow::anyhow!("Failed to read the tests directory `{path}`: {error}"))? + .map_err(|error| anyhow::anyhow!("Failed to read the tests directory {path:?}: {error}"))? .into_iter() .map(|test| Arc::new(test) as Arc) .cartesian_product(compiler.all_modes())