From 9584b4625b4700358b345f586bb1d8c49aa058eb Mon Sep 17 00:00:00 2001 From: radish19_MBA2020 Date: Fri, 12 Jul 2024 20:51:23 +0900 Subject: [PATCH] Fix linting errors --- momonga/src/eval.rs | 8 ++++---- momonga/tests/integration_test.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/momonga/src/eval.rs b/momonga/src/eval.rs index 091b804..169ca35 100644 --- a/momonga/src/eval.rs +++ b/momonga/src/eval.rs @@ -17,7 +17,7 @@ pub enum JumpStmt<'a> { Error(EvalError), } -const MAX_ABS_INT: u64 = std::i64::MIN.unsigned_abs(); // TODO: Reconsider how to handle value overflow +const MAX_ABS_INT: u64 = i64::MIN.unsigned_abs(); // TODO: Reconsider how to handle value overflow pub fn eval<'a>( program: &'a Program, @@ -40,7 +40,7 @@ fn eval_block_stmt<'a>(block_stmt: &'a BlockStmt, env: Rc>>) -> Stmt::FuncDecl(func_decl) => eval_func_decl(func_decl, Rc::clone(&env_block)), Stmt::IfStmt(if_stmt) => eval_if_stmt(if_stmt, Rc::clone(&env_block)), Stmt::ForStmt(for_stmt) => eval_for_stmt(for_stmt, Rc::clone(&env_block)), - Stmt::WhileStmt(while_stmt) => todo!(), + Stmt::WhileStmt(_while_stmt) => todo!(), Stmt::VarStmt(var_stmt) => eval_var_stmt(var_stmt, Rc::clone(&env_block)), Stmt::ExprStmt(expr_stmt) => eval_expr_stmt(expr_stmt, Rc::clone(&env_block)), Stmt::ContinueStmt => Err(JumpStmt::Continue), @@ -214,12 +214,12 @@ fn eval_expr<'a>(expr: &'a Expr, env: Rc>>) -> EvalExprResult<'a PrefixOpKind::Neg => { if let Expr::Literal(Literal::Int(int)) = **rhs { if int == MAX_ABS_INT { - return Ok(Rc::new(RefCell::new(Value::Int(std::i64::MIN)))); + return Ok(Rc::new(RefCell::new(Value::Int(i64::MIN)))); }; }; match *eval_expr(rhs, env)?.borrow() { Value::Int(int) => { - if int == std::i64::MIN { + if int == i64::MIN { return Err(JumpStmt::Error(EvalError::OutOfRange)); // Attempt to nagate i64 min } diff --git a/momonga/tests/integration_test.rs b/momonga/tests/integration_test.rs index 8c8877e..bb088b9 100644 --- a/momonga/tests/integration_test.rs +++ b/momonga/tests/integration_test.rs @@ -135,7 +135,7 @@ fn prefix_operator_is_interpreted_correctly() { r#" -9223372036854775808; // Min value of Integer type "#, - Some(std::i64::MIN.to_string()), + Some(i64::MIN.to_string()), ), ( r#" @@ -153,7 +153,7 @@ fn prefix_operator_is_interpreted_correctly() { r#" +-9223372036854775808; // Attempt to apply + operator to the min of Integer type "#, - Some(std::i64::MIN.to_string()), + Some(i64::MIN.to_string()), ), ( r#"