diff --git a/crates/samlang-heap/src/lib.rs b/crates/samlang-heap/src/lib.rs index 8371b181..a46e23b1 100644 --- a/crates/samlang-heap/src/lib.rs +++ b/crates/samlang-heap/src/lib.rs @@ -309,7 +309,7 @@ impl ModuleReference { } pub fn is_std(&self, heap: &Heap) -> bool { - self.get_parts(heap).get(0) == Some(&PStr::STD) + self.get_parts(heap).first() == Some(&PStr::STD) } pub fn pretty_print(&self, heap: &Heap) -> String { diff --git a/crates/samlang-optimization/src/loop_induction_analysis.rs b/crates/samlang-optimization/src/loop_induction_analysis.rs index a30fd91f..8d1b7a5c 100644 --- a/crates/samlang-optimization/src/loop_induction_analysis.rs +++ b/crates/samlang-optimization/src/loop_induction_analysis.rs @@ -423,7 +423,7 @@ fn extract_loop_guard_structure( non_loop_invariant_variables: &HashSet, ) -> Option { let (first_binary_stmt, second_single_if_stmt) = - (stmts.get(0).and_then(Statement::as_binary), stmts.get(1).and_then(Statement::as_single_if)); + (stmts.first().and_then(Statement::as_binary), stmts.get(1).and_then(Statement::as_single_if)); match (first_binary_stmt, second_single_if_stmt) { ( Some(Binary { name, operator, e1: Expression::Variable(e1_var), e2 }),