From 3e66d24f0bb0af11c5065f1844f75cad8f0474c6 Mon Sep 17 00:00:00 2001 From: Haled Odat <8566042+HalidOdat@users.noreply.github.com> Date: Tue, 20 Jun 2023 05:39:03 +0200 Subject: [PATCH] cargo-clippy --- boa_engine/src/bytecompiler/jump_control.rs | 4 ++-- boa_engine/src/bytecompiler/statement/mod.rs | 2 +- boa_engine/src/vm/call_frame/env_stack.rs | 14 +++++++++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/boa_engine/src/bytecompiler/jump_control.rs b/boa_engine/src/bytecompiler/jump_control.rs index bfce2c59a9c..0c86fbd0ba4 100644 --- a/boa_engine/src/bytecompiler/jump_control.rs +++ b/boa_engine/src/bytecompiler/jump_control.rs @@ -199,7 +199,7 @@ impl ByteCompiler<'_, '_> { /// Default `JumpControlInfoKind` is `JumpControlInfoKind::Loop` pub(crate) fn push_empty_loop_jump_control(&mut self, use_expr: bool) { let new_info = JumpControlInfo::default().with_loop_flag(true); - self.push_contol_info(new_info, use_expr) + self.push_contol_info(new_info, use_expr); } pub(crate) fn current_jump_control_mut(&mut self) -> Option<&mut JumpControlInfo> { @@ -222,7 +222,7 @@ impl ByteCompiler<'_, '_> { self.jump_info.push(info); } - /// Does the jump control info have the use_expr flag set to true. + /// Does the jump control info have the `use_expr` flag set to true. /// /// See [`JumpControlInfoFlags`]. pub(crate) fn jump_control_info_has_use_expr(&self) -> bool { diff --git a/boa_engine/src/bytecompiler/statement/mod.rs b/boa_engine/src/bytecompiler/statement/mod.rs index 43d9eeb14f2..c9c3ea6fc86 100644 --- a/boa_engine/src/bytecompiler/statement/mod.rs +++ b/boa_engine/src/bytecompiler/statement/mod.rs @@ -51,7 +51,7 @@ impl ByteCompiler<'_, '_> { self.emit_opcode(Opcode::PushUndefined); self.emit_opcode(Opcode::SetReturnValue); } - self.compile_break(*node, use_expr) + self.compile_break(*node, use_expr); } Statement::Throw(throw) => { self.compile_expr(throw.target(), true); diff --git a/boa_engine/src/vm/call_frame/env_stack.rs b/boa_engine/src/vm/call_frame/env_stack.rs index a217912b6a1..76cf451f4ea 100644 --- a/boa_engine/src/vm/call_frame/env_stack.rs +++ b/boa_engine/src/vm/call_frame/env_stack.rs @@ -54,14 +54,18 @@ impl EnvStackEntry { } /// Returns calling [`EnvStackEntry`] with `kind` field of [`EnvEntryKind::Try`]. - pub(crate) fn with_try_flag(mut self, fp: u32) -> Self { + pub(crate) const fn with_try_flag(mut self, fp: u32) -> Self { self.kind = EnvEntryKind::Try { fp }; self } /// Returns calling [`EnvStackEntry`] with `kind` field of [`EnvEntryKind::Loop`], loop iteration set to zero /// and iterator index set to `iterator`. - pub(crate) fn with_iterator_loop_flag(mut self, iteration_count: u64, iterator: u32) -> Self { + pub(crate) const fn with_iterator_loop_flag( + mut self, + iteration_count: u64, + iterator: u32, + ) -> Self { self.kind = EnvEntryKind::Loop { iteration_count, iterator: Some(iterator), @@ -71,7 +75,7 @@ impl EnvStackEntry { /// Returns calling [`EnvStackEntry`] with `kind` field of [`EnvEntryKind::Loop`]. /// And the loop iteration set to zero. - pub(crate) fn with_loop_flag(mut self, iteration_count: u64) -> Self { + pub(crate) const fn with_loop_flag(mut self, iteration_count: u64) -> Self { self.kind = EnvEntryKind::Loop { iteration_count, iterator: None, @@ -80,13 +84,13 @@ impl EnvStackEntry { } /// Returns calling [`EnvStackEntry`] with `kind` field of [`EnvEntryKind::Finally`]. - pub(crate) fn with_finally_flag(mut self) -> Self { + pub(crate) const fn with_finally_flag(mut self) -> Self { self.kind = EnvEntryKind::Finally; self } /// Returns calling [`EnvStackEntry`] with `kind` field of [`EnvEntryKind::Labelled`]. - pub(crate) fn with_labelled_flag(mut self) -> Self { + pub(crate) const fn with_labelled_flag(mut self) -> Self { self.kind = EnvEntryKind::Labelled; self }