From e78fdd7944d3c00f9d8dc921c246b0fdfa0887a2 Mon Sep 17 00:00:00 2001 From: Evgeny Ukhanov Date: Fri, 2 Aug 2024 11:16:39 +0200 Subject: [PATCH] clippy imporvements --- Cargo.toml | 2 +- tests/binding_tests.rs | 2 +- tests/expressions_tests.rs | 12 ++++++------ tests/if_tests.rs | 4 ++-- tests/let_binding_tests.rs | 2 +- tests/loop_tests.rs | 4 ++-- tests/main_tests.rs | 2 +- tests/state_tests.rs | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9603769..5dcc618 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "semantic-analyzer" -version = "0.4.2" +version = "0.4.3" authors = ["Evgeny Ukhanov "] description = "Semantic analyzer library for compilers written in Rust for semantic analysis of programming languages AST" keywords = ["compiler", "semantic-analisis", "semantic-alalyzer", "compiler-design", "semantic"] diff --git a/tests/binding_tests.rs b/tests/binding_tests.rs index 3521f11..f3a1cbf 100644 --- a/tests/binding_tests.rs +++ b/tests/binding_tests.rs @@ -32,7 +32,7 @@ fn binding_transform() { assert_eq!(binding.clone().to_string(), "x"); assert_eq!(binding.value, Box::new(expr_ast.into())); // For grcov - format!("{:?}", binding_ast.clone()); + let _ = format!("{:?}", binding_ast.clone()); } #[test] diff --git a/tests/expressions_tests.rs b/tests/expressions_tests.rs index 501b344..fdd4cd3 100644 --- a/tests/expressions_tests.rs +++ b/tests/expressions_tests.rs @@ -70,7 +70,7 @@ fn expression_ast_transform() { assert_eq!(value_name_into.to_string(), "x"); let expr_into: Expression = expr.into(); // For grcov - format!("{expr_into:?}"); + let _ = format!("{expr_into:?}"); assert_eq!(expr_into.expression_value.to_string(), "x"); assert_eq!(expr_into.to_string(), "x"); let value_name_into2: ValueName = String::from("x1").into(); @@ -398,7 +398,7 @@ fn expression_ast_transform_expression() { operation: None, } .into(); - format!("{expr:#?}"); + let _ = format!("{expr:#?}"); assert_eq!(expr.to_string(), "ptr"); } @@ -785,7 +785,7 @@ fn expression_struct_value() { let expression_st_value_into: ExpressionValue = expression_st_value.clone().into(); assert_eq!(expression_st_value_into.to_string(), "x"); // For grcov - format!("{expression_st_value_into:?}"); + let _ = format!("{expression_st_value_into:?}"); let expr = ast::Expression { expression_value: expression_st_value, operation: None, @@ -849,7 +849,7 @@ fn expression_func_call() { let expr_value_into: ExpressionValue = ast_fn_call.clone().into(); assert_eq!(expr_value_into.to_string(), "fn1"); // For grcov - format!("{expr_value_into:?}"); + let _ = format!("{expr_value_into:?}"); let expr = ast::Expression { expression_value: ast_fn_call, operation: None, @@ -1369,9 +1369,9 @@ fn custom_expression() { let expr_into: Expression = expr.clone().into(); // For grcov - format!("{:#?}", expr_into); + let _ = format!("{:#?}", expr_into); // For grcov - format!("{:#?}", expr_into.to_string()); + let _ = format!("{:#?}", expr_into.to_string()); let res = state.expression(&expr, &block_state).unwrap(); assert!(state.errors.is_empty()); diff --git a/tests/if_tests.rs b/tests/if_tests.rs index e5d9cb8..c0560ae 100644 --- a/tests/if_tests.rs +++ b/tests/if_tests.rs @@ -112,7 +112,7 @@ fn if_single_transform() { assert_eq!(if_compare1, if_compare2); assert_eq!(if_statement1.location(), CodeLocation::new(1, 0)); // For grcov - format!("{if_statement1:?}"); + let _ = format!("{if_statement1:?}"); } #[test] @@ -252,7 +252,7 @@ fn if_logic_transform() { else_if_statement: None, }; // For grcov - format!("{if_statement3:?}"); + let _ = format!("{if_statement3:?}"); let expr_logic_cond_into: ExpressionLogicCondition = expr_logic_cond.into(); assert_eq!( expr_logic_cond_into.left, diff --git a/tests/let_binding_tests.rs b/tests/let_binding_tests.rs index 2597b22..854ff40 100644 --- a/tests/let_binding_tests.rs +++ b/tests/let_binding_tests.rs @@ -39,7 +39,7 @@ fn let_binding_transform() { ); assert_eq!(let_binding.value, Box::new(expr_ast.into())); // For grcov - format!("{:?}", let_binding_ast.clone()); + let _ = format!("{:?}", let_binding_ast.clone()); } #[test] diff --git a/tests/loop_tests.rs b/tests/loop_tests.rs index 1345f78..7577999 100644 --- a/tests/loop_tests.rs +++ b/tests/loop_tests.rs @@ -63,11 +63,11 @@ fn loop_transform() { ast::LoopBodyStatement::Continue, ]; // For grcov - format!("{loop_stmts:#?}"); + let _ = format!("{loop_stmts:#?}"); for loop_stmt in loop_stmts { let loop_stmt_into: LoopBodyStatement = loop_stmt.into(); // For grcov - format!("{loop_stmt_into:#?}"); + let _ = format!("{loop_stmt_into:#?}"); match loop_stmt_into { LoopBodyStatement::LetBinding(val) => assert_eq!(val, let_binding.clone().into()), LoopBodyStatement::Binding(val) => assert_eq!(val, binding.clone().into()), diff --git a/tests/main_tests.rs b/tests/main_tests.rs index 8a63856..9252663 100644 --- a/tests/main_tests.rs +++ b/tests/main_tests.rs @@ -110,7 +110,7 @@ fn main_run() { CustomExpression, > = vec![import_stm, constant_stm, ty_stm, fn_stm, fn2_stm]; // For grcov - format!("{main_stm:#?}"); + let _ = format!("{main_stm:#?}"); t.state.run(&main_stm); assert!(t.is_empty_error()); diff --git a/tests/state_tests.rs b/tests/state_tests.rs index 9ca24b8..d0aec9f 100644 --- a/tests/state_tests.rs +++ b/tests/state_tests.rs @@ -22,7 +22,7 @@ mod utils; fn state_init() { let st = State::, CustomExpressionInstruction>::default(); // For grcov - format!("{st:?}"); + let _ = format!("{st:?}"); assert!(st.global.types.is_empty()); assert!(st.global.constants.is_empty()); assert!(st.global.functions.is_empty()); @@ -247,7 +247,7 @@ fn block_state_last_register_inc() { bst3.inc_register(); assert_eq!(bst3.last_register_number, 1); // For grcov - format!("{bst3:?}"); + let _ = format!("{bst3:?}"); } #[test]