diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index 07ae535a454..3fa070106cd 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -19,7 +19,7 @@ jobs: timeout-minutes: 30 env: RUSTFLAGS: -Dwarnings - + strategy: fail-fast: false matrix: @@ -53,7 +53,7 @@ jobs: name: eslint runs-on: ubuntu-latest timeout-minutes: 30 - + steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/publish-nargo.yml b/.github/workflows/publish-nargo.yml index 9d3ff9423ea..15ed04f3f71 100644 --- a/.github/workflows/publish-nargo.yml +++ b/.github/workflows/publish-nargo.yml @@ -81,7 +81,7 @@ jobs: - name: Test built artifact if: matrix.target == 'x86_64-apple-darwin' run: | - cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/ + cp ./target/${{ matrix.target }}/release/nargo ~/.cargo/bin/ yarn workspace release-tests test - name: Upload binaries to release tag diff --git a/.github/workflows/test-noir_wasm.yml b/.github/workflows/test-noir_wasm.yml index 82c094959bc..86362ef7ceb 100644 --- a/.github/workflows/test-noir_wasm.yml +++ b/.github/workflows/test-noir_wasm.yml @@ -119,7 +119,7 @@ jobs: cp -r ./compiler/wasm/downloaded/nodejs ./compiler/wasm cp -r ./compiler/wasm/downloaded/web ./compiler/wasm yarn workspace @noir-lang/source-resolver build - + - name: Run node tests run: yarn workspace @noir-lang/noir_wasm test:node diff --git a/acvm-repo/acir/src/circuit/black_box_functions.rs b/acvm-repo/acir/src/circuit/black_box_functions.rs index 17c990c7670..499d16dd2c5 100644 --- a/acvm-repo/acir/src/circuit/black_box_functions.rs +++ b/acvm-repo/acir/src/circuit/black_box_functions.rs @@ -107,7 +107,7 @@ mod tests { fn consistent_function_names() { for bb_func in BlackBoxFunc::iter() { let resolved_func = BlackBoxFunc::lookup(bb_func.name()).unwrap_or_else(|| { - panic!("BlackBoxFunc::lookup couldn't find black box function {}", bb_func) + panic!("BlackBoxFunc::lookup couldn't find black box function {bb_func}") }); assert_eq!( resolved_func, bb_func, diff --git a/acvm-repo/acir_field/src/generic_ark.rs b/acvm-repo/acir_field/src/generic_ark.rs index 59600549f32..c030819366f 100644 --- a/acvm-repo/acir_field/src/generic_ark.rs +++ b/acvm-repo/acir_field/src/generic_ark.rs @@ -341,7 +341,7 @@ impl FieldElement { let and_byte_arr: Vec<_> = lhs_bytes .into_iter() - .zip(rhs_bytes.into_iter()) + .zip(rhs_bytes) .map(|(lhs, rhs)| if is_xor { lhs ^ rhs } else { lhs & rhs }) .collect(); diff --git a/acvm-repo/acvm/src/compiler/optimizers/general.rs b/acvm-repo/acvm/src/compiler/optimizers/general.rs index be5359a4114..50271348c11 100644 --- a/acvm-repo/acvm/src/compiler/optimizers/general.rs +++ b/acvm-repo/acvm/src/compiler/optimizers/general.rs @@ -32,7 +32,7 @@ fn simplify_mul_terms(mut gate: Expression) -> Expression { // Canonicalize the ordering of the multiplication, lets just order by variable name for (scale, w_l, w_r) in gate.mul_terms.clone().into_iter() { - let mut pair = vec![w_l, w_r]; + let mut pair = [w_l, w_r]; // Sort using rust sort algorithm pair.sort(); diff --git a/acvm-repo/acvm/src/pwg/blackbox/range.rs b/acvm-repo/acvm/src/pwg/blackbox/range.rs index 2c2b96cd753..1b976e30ed5 100644 --- a/acvm-repo/acvm/src/pwg/blackbox/range.rs +++ b/acvm-repo/acvm/src/pwg/blackbox/range.rs @@ -5,7 +5,7 @@ use crate::{ use acir::{circuit::opcodes::FunctionInput, native_types::WitnessMap}; pub(super) fn solve_range_opcode( - initial_witness: &mut WitnessMap, + initial_witness: &WitnessMap, input: &FunctionInput, ) -> Result<(), OpcodeResolutionError> { let w_value = witness_to_value(initial_witness, input.witness)?; diff --git a/compiler/fm/src/lib.rs b/compiler/fm/src/lib.rs index 1703db8d048..9375e8c39bd 100644 --- a/compiler/fm/src/lib.rs +++ b/compiler/fm/src/lib.rs @@ -277,7 +277,7 @@ mod tests { // - dir/lib.nr // - dir/sub_dir.nr // - dir/sub_dir/foo.nr - create_dummy_file(&dir, Path::new(&format!("{}.nr", sub_dir_name))); + create_dummy_file(&dir, Path::new(&format!("{sub_dir_name}.nr"))); // First check for the sub_dir.nr file and add it to the FileManager let sub_dir_file_id = fm.find_module(file_id, sub_dir_name).unwrap(); diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block_variables.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block_variables.rs index cc65a84f1fa..eb7bab8c971 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block_variables.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_block_variables.rs @@ -31,7 +31,7 @@ impl BlockVariables { /// Returns all non-constant variables that have not been removed at this point. pub(crate) fn get_available_variables( &self, - function_context: &mut FunctionContext, + function_context: &FunctionContext, ) -> Vec { self.available_variables .iter() @@ -95,8 +95,7 @@ impl BlockVariables { } else { assert!( self.available_variables.contains(&value_id), - "ICE: ValueId {:?} is not available", - value_id + "ICE: ValueId {value_id:?} is not available" ); *function_context diff --git a/compiler/noirc_frontend/src/graph/mod.rs b/compiler/noirc_frontend/src/graph/mod.rs index d8c539038df..3a40c87d8e7 100644 --- a/compiler/noirc_frontend/src/graph/mod.rs +++ b/compiler/noirc_frontend/src/graph/mod.rs @@ -312,7 +312,7 @@ mod tests { let mut vec_ids = Vec::with_capacity(n); for i in 0..n { let mut pth = PathBuf::new(); - pth.push(format!("{}", i)); + pth.push(format!("{i}")); pth.set_extension(FILE_EXTENSION); vec_ids.push(fm.add_file(pth.into(), String::new())); } diff --git a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs index 86369a66758..07ad6f598bd 100644 --- a/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs +++ b/compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs @@ -412,7 +412,7 @@ fn collect_impls( fn collect_trait_impl_methods( interner: &mut NodeInterner, - def_maps: &mut BTreeMap, + def_maps: &BTreeMap, crate_id: CrateId, trait_id: TraitId, trait_impl: &mut UnresolvedTraitImpl, diff --git a/compiler/noirc_frontend/src/hir/resolution/resolver.rs b/compiler/noirc_frontend/src/hir/resolution/resolver.rs index 3ddb3b9efa9..94ef9ec9d4e 100644 --- a/compiler/noirc_frontend/src/hir/resolution/resolver.rs +++ b/compiler/noirc_frontend/src/hir/resolution/resolver.rs @@ -1761,7 +1761,7 @@ mod test { let errors = resolve_src_code(src, vec!["main"]); // There should only be one error - assert!(errors.len() == 1, "Expected 1 error, got: {:?}", errors); + assert!(errors.len() == 1, "Expected 1 error, got: {errors:?}"); // It should be regarding the unused variable match &errors[0] { @@ -1831,7 +1831,7 @@ mod test { "#; let errors = resolve_src_code(src, vec!["main"]); - assert!(errors.len() == 3, "Expected 3 errors, got: {:?}", errors); + assert!(errors.len() == 3, "Expected 3 errors, got: {errors:?}"); // Errors are: // `a` is undeclared @@ -1907,7 +1907,7 @@ mod test { "#; let errors = resolve_src_code(src, vec!["main", "foo"]); if !errors.is_empty() { - println!("Unexpected errors: {:?}", errors); + println!("Unexpected errors: {errors:?}"); unreachable!("there should be no errors"); } } @@ -1979,7 +1979,7 @@ mod test { let errors = resolve_src_code(src, vec!["main", "foo"]); assert!(errors.is_empty()); if !errors.is_empty() { - println!("Unexpected errors: {:?}", errors); + println!("Unexpected errors: {errors:?}"); unreachable!("there should be no errors"); } @@ -2021,7 +2021,7 @@ mod test { "#; let errors = resolve_src_code(src, vec!["main", "println"]); - assert!(errors.len() == 2, "Expected 2 errors, got: {:?}", errors); + assert!(errors.len() == 2, "Expected 2 errors, got: {errors:?}"); for err in errors { match &err { diff --git a/compiler/noirc_frontend/src/lexer/token.rs b/compiler/noirc_frontend/src/lexer/token.rs index d36591e8f13..56547c32a01 100644 --- a/compiler/noirc_frontend/src/lexer/token.rs +++ b/compiler/noirc_frontend/src/lexer/token.rs @@ -407,8 +407,8 @@ pub enum Attribute { impl fmt::Display for Attribute { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - Attribute::Function(attribute) => write!(f, "{}", attribute), - Attribute::Secondary(attribute) => write!(f, "{}", attribute), + Attribute::Function(attribute) => write!(f, "{attribute}"), + Attribute::Secondary(attribute) => write!(f, "{attribute}"), } } } @@ -529,7 +529,7 @@ impl FunctionAttribute { impl fmt::Display for FunctionAttribute { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - FunctionAttribute::Test(scope) => write!(f, "#[test{}]", scope), + FunctionAttribute::Test(scope) => write!(f, "#[test{scope}]"), FunctionAttribute::Foreign(ref k) => write!(f, "#[foreign({k})]"), FunctionAttribute::Builtin(ref k) => write!(f, "#[builtin({k})]"), FunctionAttribute::Oracle(ref k) => write!(f, "#[oracle({k})]"), @@ -732,7 +732,7 @@ mod keywords { for keyword in Keyword::iter() { let resolved_token = Keyword::lookup_keyword(&format!("{keyword}")).unwrap_or_else(|| { - panic!("Keyword::lookup_keyword couldn't find Keyword {}", keyword) + panic!("Keyword::lookup_keyword couldn't find Keyword {keyword}") }); assert_eq!( diff --git a/compiler/noirc_frontend/src/parser/parser.rs b/compiler/noirc_frontend/src/parser/parser.rs index 2d84bcdd4b4..2e8b70d9249 100644 --- a/compiler/noirc_frontend/src/parser/parser.rs +++ b/compiler/noirc_frontend/src/parser/parser.rs @@ -1631,7 +1631,7 @@ mod test { P: NoirParser, { vecmap(programs, move |program| { - let message = format!("Failed to parse:\n{}", program); + let message = format!("Failed to parse:\n{program}"); let (op_t, diagnostics) = parse_recover(&parser, program); diagnostics.iter().for_each(|diagnostic| { if diagnostic.is_error() { @@ -2356,8 +2356,7 @@ mod test { let num_errors = errors.len(); let shown_errors = show_errors(errors); eprintln!( - "\nExpected {} error(s) and got {}:\n\n{}\n\nFrom input: {}\nExpected AST: {}\nActual AST: {}\n", - expected_errors, num_errors, shown_errors, src, expected_result, actual); + "\nExpected {expected_errors} error(s) and got {num_errors}:\n\n{shown_errors}\n\nFrom input: {src}\nExpected AST: {expected_result}\nActual AST: {actual}\n"); } result }); diff --git a/compiler/wasm/src/compile.rs b/compiler/wasm/src/compile.rs index 6e756325bae..73da5bf245e 100644 --- a/compiler/wasm/src/compile.rs +++ b/compiler/wasm/src/compile.rs @@ -80,7 +80,7 @@ fn add_noir_lib(context: &mut Context, library_name: &str) { context .crate_graph .add_dep(crate_id, library_name.parse().unwrap(), library_crate_id) - .unwrap_or_else(|_| panic!("ICE: Cyclic error triggered by {} library", library_name)); + .unwrap_or_else(|_| panic!("ICE: Cyclic error triggered by {library_name} library")); } } diff --git a/tooling/lsp/src/lib.rs b/tooling/lsp/src/lib.rs index ae174da1b33..17c2a6ba607 100644 --- a/tooling/lsp/src/lib.rs +++ b/tooling/lsp/src/lib.rs @@ -309,7 +309,7 @@ fn on_tests_request( // We can reconsider this when we can build a file without the need for a Nargo.toml file to resolve deps let _ = state.client.log_message(LogMessageParams { typ: MessageType::WARNING, - message: format!("{}", err), + message: err.to_string(), }); return future::ready(Ok(None)); } @@ -318,10 +318,7 @@ fn on_tests_request( Ok(workspace) => workspace, Err(err) => { // If we found a manifest, but the workspace is invalid, we raise an error about it - return future::ready(Err(ResponseError::new( - ErrorCode::REQUEST_FAILED, - format!("{}", err), - ))); + return future::ready(Err(ResponseError::new(ErrorCode::REQUEST_FAILED, err))); } }; @@ -382,7 +379,7 @@ fn on_code_lens_request( // We can reconsider this when we can build a file without the need for a Nargo.toml file to resolve deps let _ = state.client.log_message(LogMessageParams { typ: MessageType::WARNING, - message: format!("{err}"), + message: err.to_string(), }); return future::ready(Ok(None)); } @@ -391,10 +388,7 @@ fn on_code_lens_request( Ok(workspace) => workspace, Err(err) => { // If we found a manifest, but the workspace is invalid, we raise an error about it - return future::ready(Err(ResponseError::new( - ErrorCode::REQUEST_FAILED, - format!("{err}"), - ))); + return future::ready(Err(ResponseError::new(ErrorCode::REQUEST_FAILED, err))); } }; diff --git a/tooling/nargo_cli/build.rs b/tooling/nargo_cli/build.rs index ff941e41f36..8a8f2e97c2e 100644 --- a/tooling/nargo_cli/build.rs +++ b/tooling/nargo_cli/build.rs @@ -105,7 +105,7 @@ fn generate_compile_success_empty_tests(test_file: &mut File, test_data_dir: &Pa r#" #[test] fn compile_success_empty_{test_name}() {{ - + // We use a mocked backend for this test as we do not rely on the returned circuit size // but we must call a backend as part of querying the number of opcodes in the circuit.