From 354f2417b36f924e9da50870fa6f437100f7400a Mon Sep 17 00:00:00 2001 From: arty Date: Wed, 8 May 2024 08:59:32 -0700 Subject: [PATCH 1/2] new clippy traffic --- src/classic/clvm_tools/cmds.rs | 10 +++++----- src/classic/clvm_tools/stages/stage_2/optimize.rs | 2 +- src/classic/platform/argparse.rs | 5 +---- src/compiler/codegen.rs | 6 ++++-- src/compiler/compiler.rs | 2 +- src/compiler/comptypes.rs | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/classic/clvm_tools/cmds.rs b/src/classic/clvm_tools/cmds.rs index 9bf9771e3..21a2dcc5d 100644 --- a/src/classic/clvm_tools/cmds.rs +++ b/src/classic/clvm_tools/cmds.rs @@ -584,7 +584,7 @@ pub fn cldb(args: &[String]) { } if let Some(ArgumentValue::ArgString(file, path_or_code)) = parsed_args.get("path_or_code") { - input_file = file.clone(); + input_file.clone_from(file); input_program = path_or_code.to_string(); } @@ -1117,7 +1117,7 @@ pub fn launch_tool(stdout: &mut Stream, args: &[String], tool_name: &str, defaul let mut input_program = "()".to_string(); if let Some(ArgumentValue::ArgString(file, path_or_code)) = parsed_args.get("path_or_code") { - input_file = file.clone(); + input_file.clone_from(file); input_program = path_or_code.to_string(); } @@ -1179,7 +1179,7 @@ pub fn launch_tool(stdout: &mut Stream, args: &[String], tool_name: &str, defaul } if let Some(ArgumentValue::ArgString(file, path_or_code)) = parsed_args.get("env") { - input_file = file.clone(); + input_file.clone_from(file); input_args = path_or_code.to_string(); } @@ -1244,8 +1244,8 @@ pub fn launch_tool(stdout: &mut Stream, args: &[String], tool_name: &str, defaul if let Some(ArgumentValue::ArgString(f, content)) = parsed_args.get("path_or_code") { match read_ir(content) { Ok(s) => { - input_program = content.clone(); - input_file = f.clone(); + input_program.clone_from(content); + input_file.clone_from(f); src_sexp = s; } Err(e) => { diff --git a/src/classic/clvm_tools/stages/stage_2/optimize.rs b/src/classic/clvm_tools/stages/stage_2/optimize.rs index 9aef8e77c..c3c7d2fa7 100644 --- a/src/classic/clvm_tools/stages/stage_2/optimize.rs +++ b/src/classic/clvm_tools/stages/stage_2/optimize.rs @@ -688,7 +688,7 @@ pub fn optimize_sexp_( } SExp::Pair(_, _) => { for opt in optimizers.iter() { - name = opt.name.clone(); + name.clone_from(&opt.name); match opt.invoke(allocator, memo, r, eval_f.clone()) { Err(e) => { return Err(e); diff --git a/src/classic/platform/argparse.rs b/src/classic/platform/argparse.rs index 916d1343f..eea96c176 100644 --- a/src/classic/platform/argparse.rs +++ b/src/classic/platform/argparse.rs @@ -491,10 +491,7 @@ impl ArgumentParser { } let name = &self.optional_args[k].names[index as usize]; - let index2 = match arg.find(name) { - Some(i) => i, - _ => 0, - } + name.len(); + let index2 = arg.find(name).unwrap_or_default() + name.len(); let value = &arg[index2..].to_string(); norm.push(name.to_string()); diff --git a/src/compiler/codegen.rs b/src/compiler/codegen.rs index af3fcb4c9..08d695827 100644 --- a/src/compiler/codegen.rs +++ b/src/compiler/codegen.rs @@ -1520,7 +1520,7 @@ fn start_codegen( )), }; - code_generator.to_process = program.helpers.clone(); + code_generator.to_process.clone_from(&program.helpers); // Ensure that we have the synthesis of the previous codegen's helpers and // The ones provided with the new form if any. let mut combined_helpers_for_codegen = program.helpers.clone(); @@ -1716,7 +1716,9 @@ pub fn codegen( // If stepping 23 or greater, we support no-env mode. enable_nil_env_mode_for_stepping_23_or_greater(opts.clone(), &mut code_generator); - *context.symbols() = code_generator.function_symbols.clone(); + context + .symbols() + .clone_from(&code_generator.function_symbols); context .symbols() .insert("source_file".to_string(), opts.filename()); diff --git a/src/compiler/compiler.rs b/src/compiler/compiler.rs index cce5566d8..7b8a9bb27 100644 --- a/src/compiler/compiler.rs +++ b/src/compiler/compiler.rs @@ -222,7 +222,7 @@ impl CompilerOpts for DefaultCompilerOpts { } fn set_search_paths(&self, dirs: &[String]) -> Rc { let mut copy = self.clone(); - copy.include_dirs = dirs.to_owned(); + dirs.clone_into(&mut copy.include_dirs); Rc::new(copy) } fn set_disassembly_ver(&self, ver: Option) -> Rc { diff --git a/src/compiler/comptypes.rs b/src/compiler/comptypes.rs index 8ba656dbf..af9f4840e 100644 --- a/src/compiler/comptypes.rs +++ b/src/compiler/comptypes.rs @@ -1227,7 +1227,7 @@ pub fn join_vecs_to_string(sep: Vec, vecs: &[Vec]) -> String { s.append(&mut comma.clone()); s.append(&mut elt.to_vec()); if comma.is_empty() { - comma = sep.clone(); + comma.clone_from(&sep); } } From 0a8081c668110c263938264d36cb5105367f736e Mon Sep 17 00:00:00 2001 From: arty Date: Wed, 8 May 2024 09:44:07 -0700 Subject: [PATCH 2/2] Update wasm-bindgen as a deprecation warning was coming from code generated by the earlier version we captured and that led to a test failure --- wasm/Cargo.lock | 24 ++++++++++++------------ wasm/Cargo.toml | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index bd6a1e9e4..51a0877c6 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -1178,9 +1178,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "serde", @@ -1190,16 +1190,16 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.28", "wasm-bindgen-shared", ] @@ -1217,9 +1217,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1227,22 +1227,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.28", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-bindgen-test" diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 4252e59c9..2b7c204d4 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -19,7 +19,7 @@ path = "src/mod.rs" [dependencies] clvm_tools_rs = { path= "..", features = [] } clvmr = { version = "0.3.0", features = ["pre-eval"] } -wasm-bindgen = "=0.2.83" +wasm-bindgen = "=0.2.92" wasm-bindgen-test = "=0.3.25" js-sys = "0.3.60" num-bigint = "0.4.0"