Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: clippy imporvements #33

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "semantic-analyzer"
version = "0.4.2"
version = "0.4.3"
authors = ["Evgeny Ukhanov <mrlsd@ya.ru>"]
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"]
Expand Down
2 changes: 1 addition & 1 deletion tests/binding_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
12 changes: 6 additions & 6 deletions tests/expressions_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -398,7 +398,7 @@ fn expression_ast_transform_expression() {
operation: None,
}
.into();
format!("{expr:#?}");
let _ = format!("{expr:#?}");
assert_eq!(expr.to_string(), "ptr");
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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());

Expand Down
4 changes: 2 additions & 2 deletions tests/if_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/let_binding_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions tests/loop_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
2 changes: 1 addition & 1 deletion tests/main_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn main_run() {
CustomExpression<CustomExpressionInstruction>,
> = 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());

Expand Down
4 changes: 2 additions & 2 deletions tests/state_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod utils;
fn state_init() {
let st = State::<CustomExpression<CustomExpressionInstruction>, 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());
Expand Down Expand Up @@ -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]
Expand Down
Loading