From 7702df69f205d62ae9259c264a50eb13f4dd4cb6 Mon Sep 17 00:00:00 2001 From: ls Date: Fri, 25 Oct 2024 16:54:53 +0200 Subject: [PATCH 1/2] clippy: use matches! macro --- main/src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/src/main.rs b/main/src/main.rs index 82e781a..e6c3f87 100644 --- a/main/src/main.rs +++ b/main/src/main.rs @@ -487,10 +487,10 @@ fn main() -> Result<()> { // supported. These extensions are now incorporated as part of the `cargo-stylus` command itself and // will be the preferred method of running them. fn is_deprecated_extension(subcommand: &str) -> bool { - match subcommand { - "cargo-stylus-check" | "cargo-stylus-cgen" | "cargo-stylus-replay" => true, - _ => false, - } + matches!( + subcommand, + "cargo-stylus-check" | "cargo-stylus-cgen" | "cargo-stylus-replay" + ) } async fn main_impl(args: Opts) -> Result<()> { From 42acf69ba0da83678ad6ae168af4f804487c671c Mon Sep 17 00:00:00 2001 From: ls Date: Fri, 25 Oct 2024 16:55:08 +0200 Subject: [PATCH 2/2] clippy: use array rather than vec --- main/src/project.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/src/project.rs b/main/src/project.rs index 0f0fd4e..5de4872 100644 --- a/main/src/project.rs +++ b/main/src/project.rs @@ -457,15 +457,15 @@ mod test { let dir = tempdir()?; let dir_path = dir.path(); - let files = vec!["file.rs", "ignore.me", "Cargo.toml", "Cargo.lock"]; - for file in files.iter() { + let files = ["file.rs", "ignore.me", "Cargo.toml", "Cargo.lock"]; + for file in files { let file_path = dir_path.join(file); let mut file = File::create(&file_path)?; writeln!(file, "Test content")?; } - let dirs = vec!["nested", ".git", "target"]; - for d in dirs.iter() { + let dirs = ["nested", ".git", "target"]; + for d in dirs { let subdir_path = dir_path.join(d); if !subdir_path.exists() { fs::create_dir(&subdir_path)?;