Browse Source

Switch `allow` to `expect`

expect-lints
José Julián Espina 1 month ago
parent
commit
ffc654680c
No known key found for this signature in database
GPG Key ID: 1E1AFCAE118C0954
  1. 2
      cli/src/debug/mod.rs
  2. 6
      cli/src/helper.rs
  3. 12
      cli/src/main.rs
  4. 2
      core/ast/src/lib.rs
  5. 8
      core/ast/src/scope.rs
  6. 7
      core/ast/src/scope_analyzer.rs
  7. 4
      core/ast/src/visitor.rs
  8. 2402
      core/engine/output.rs
  9. 11
      core/engine/src/builtins/array/mod.rs
  10. 4
      core/engine/src/builtins/array_buffer/mod.rs
  11. 2
      core/engine/src/builtins/array_buffer/shared.rs
  12. 6
      core/engine/src/builtins/bigint/mod.rs
  13. 2
      core/engine/src/builtins/boolean/mod.rs
  14. 7
      core/engine/src/builtins/builder.rs
  15. 4
      core/engine/src/builtins/date/mod.rs
  16. 2
      core/engine/src/builtins/error/mod.rs
  17. 6
      core/engine/src/builtins/function/arguments.rs
  18. 4
      core/engine/src/builtins/function/bound.rs
  19. 4
      core/engine/src/builtins/function/mod.rs
  20. 2
      core/engine/src/builtins/function/tests.rs
  21. 2
      core/engine/src/builtins/intl/collator/mod.rs
  22. 3
      core/engine/src/builtins/intl/date_time_format.rs
  23. 1
      core/engine/src/builtins/intl/list_format/mod.rs
  24. 1
      core/engine/src/builtins/intl/number_format/options.rs
  25. 1
      core/engine/src/builtins/intl/plural_rules/mod.rs
  26. 2
      core/engine/src/builtins/map/mod.rs
  27. 6
      core/engine/src/builtins/math/mod.rs
  28. 1
      core/engine/src/builtins/mod.rs
  29. 2
      core/engine/src/builtins/number/conversions.rs
  30. 1
      core/engine/src/builtins/number/globals.rs
  31. 30
      core/engine/src/builtins/number/mod.rs
  32. 2
      core/engine/src/builtins/object/mod.rs
  33. 4
      core/engine/src/builtins/options.rs
  34. 2
      core/engine/src/builtins/promise/mod.rs
  35. 2
      core/engine/src/builtins/promise/tests.rs
  36. 5
      core/engine/src/builtins/regexp/mod.rs
  37. 2
      core/engine/src/builtins/set/mod.rs
  38. 3
      core/engine/src/builtins/string/mod.rs
  39. 1
      core/engine/src/builtins/symbol/mod.rs
  40. 2
      core/engine/src/builtins/temporal/calendar/mod.rs
  41. 3
      core/engine/src/builtins/temporal/mod.rs
  42. 14
      core/engine/src/builtins/temporal/now.rs
  43. 2
      core/engine/src/builtins/temporal/options.rs
  44. 2
      core/engine/src/builtins/temporal/time_zone/mod.rs
  45. 5
      core/engine/src/builtins/typed_array/builtin.rs
  46. 3
      core/engine/src/builtins/typed_array/element/mod.rs
  47. 2
      core/engine/src/builtins/typed_array/mod.rs
  48. 2
      core/engine/src/builtins/typed_array/object.rs
  49. 4
      core/engine/src/builtins/uri/mod.rs
  50. 54
      core/engine/src/bytecompiler/declarations.rs
  51. 2
      core/engine/src/bytecompiler/function.rs
  52. 15
      core/engine/src/bytecompiler/mod.rs
  53. 2
      core/engine/src/bytecompiler/module.rs
  54. 2
      core/engine/src/bytecompiler/register.rs
  55. 1
      core/engine/src/bytecompiler/statement/continue.rs
  56. 2
      core/engine/src/class.rs
  57. 4
      core/engine/src/context/mod.rs
  58. 2
      core/engine/src/host_defined.rs
  59. 2
      core/engine/src/job.rs
  60. 2
      core/engine/src/module/loader.rs
  61. 5
      core/engine/src/module/mod.rs
  62. 10
      core/engine/src/module/namespace.rs
  63. 3
      core/engine/src/module/source.rs
  64. 1
      core/engine/src/module/synthetic.rs
  65. 4
      core/engine/src/object/builtins/jsarray.rs
  66. 6
      core/engine/src/object/builtins/jspromise.rs
  67. 4
      core/engine/src/object/builtins/jstypedarray.rs
  68. 2
      core/engine/src/object/internal_methods/immutable_prototype.rs
  69. 14
      core/engine/src/object/internal_methods/mod.rs
  70. 2
      core/engine/src/object/internal_methods/string.rs
  71. 5
      core/engine/src/object/jsobject.rs
  72. 2
      core/engine/src/object/operations.rs
  73. 1
      core/engine/src/object/property_map.rs
  74. 2
      core/engine/src/object/shape/shared_shape/mod.rs
  75. 2
      core/engine/src/optimizer/mod.rs
  76. 1
      core/engine/src/property/mod.rs
  77. 4
      core/engine/src/script.rs
  78. 5
      core/engine/src/small_map/mod.rs
  79. 4
      core/engine/src/string.rs
  80. 2
      core/engine/src/symbol.rs
  81. 6
      core/engine/src/tagged.rs
  82. 6
      core/engine/src/tests/iterators.rs
  83. 2
      core/engine/src/tests/promise.rs
  84. 2
      core/engine/src/value/conversions/mod.rs
  85. 2
      core/engine/src/value/equality.rs
  86. 3
      core/engine/src/value/mod.rs
  87. 2
      core/engine/src/value/operations.rs
  88. 4
      core/engine/src/value/tests.rs
  89. 4
      core/engine/src/vm/call_frame/mod.rs
  90. 1
      core/engine/src/vm/completion_record.rs
  91. 2
      core/engine/src/vm/flowgraph/color.rs
  92. 2
      core/engine/src/vm/flowgraph/mod.rs
  93. 5
      core/engine/src/vm/mod.rs
  94. 6
      core/engine/src/vm/opcode/control_flow/return.rs
  95. 4
      core/engine/src/vm/opcode/define/mod.rs
  96. 2
      core/engine/src/vm/opcode/get/argument.rs
  97. 2
      core/engine/src/vm/opcode/get/function.rs
  98. 2
      core/engine/src/vm/opcode/global.rs
  99. 5
      core/engine/src/vm/opcode/locals/mod.rs
  100. 6
      core/engine/src/vm/opcode/mod.rs
  101. Some files were not shown because too many files have changed in this diff Show More

2
cli/src/debug/mod.rs

@ -66,7 +66,7 @@ fn create_boa_object(context: &mut Context) -> JsObject {
.build()
}
#[allow(clippy::redundant_pub_crate)]
#[expect(clippy::redundant_pub_crate)]
pub(crate) fn init_boa_debug_object(context: &mut Context) {
let boa_object = create_boa_object(context);
context

6
cli/src/helper.rs

@ -35,7 +35,7 @@ const IDENTIFIER_COLOR: Color = Color::TrueColor {
const READLINE_COLOR: Color = Color::Cyan;
#[allow(clippy::upper_case_acronyms, clippy::redundant_pub_crate)]
#[expect(clippy::redundant_pub_crate)]
#[derive(Completer, Helper, Hinter)]
pub(crate) struct RLHelper {
highlighter: LineHighlighter,
@ -72,7 +72,7 @@ impl Highlighter for RLHelper {
}
// Must match signature of Highlighter::highlight_prompt, can't elide lifetimes.
#[allow(single_use_lifetimes)]
#[expect(single_use_lifetimes)]
fn highlight_prompt<'b, 's: 'b, 'p: 'b>(
&'s self,
prompt: &'p str,
@ -169,7 +169,7 @@ impl Highlighter for LineHighlighter {
impl Replacer for Colorizer {
// Changing to map_or_else moves the handling of "identifier" after all other kinds,
// which reads worse than this version.
#[allow(clippy::option_if_let_else)]
#[expect(clippy::option_if_let_else)]
fn replace_append(&mut self, caps: &Captures<'_>, dst: &mut String) {
let colored = if let Some(cap) = caps.name("identifier") {
let cap = cap.as_str();

12
cli/src/main.rs

@ -53,12 +53,12 @@ static ALLOC: dhat::Alloc = dhat::Alloc;
/// CLI configuration for Boa.
static CLI_HISTORY: &str = ".boa_history";
// Added #[allow(clippy::option_option)] because to StructOpt an Option<Option<T>>
// is an optional argument that optionally takes a value ([--opt=[val]]).
// https://docs.rs/structopt/0.3.11/structopt/#type-magic
#[derive(Debug, Parser)]
#[command(author, version, about, name = "boa")]
#[allow(clippy::struct_excessive_bools)] // NOTE: Allow having more than 3 bools in struct
#[expect(
clippy::struct_excessive_bools,
reason = "Allow having more than 3 bools in struct"
)]
struct Opt {
/// The JavaScript file(s) to be evaluated.
#[arg(name = "FILE", value_hint = ValueHint::FilePath)]
@ -77,7 +77,7 @@ struct Opt {
value_enum,
conflicts_with = "graph"
)]
#[allow(clippy::option_option)]
#[expect(clippy::option_option)]
dump_ast: Option<Option<DumpFormat>>,
/// Dump the AST to stdout with the given format.
@ -102,7 +102,7 @@ struct Opt {
value_enum,
group = "graph"
)]
#[allow(clippy::option_option)]
#[expect(clippy::option_option)]
flowgraph: Option<Option<FlowgraphFormat>>,
/// Specifies the direction of the flowgraph. Default is top-top-bottom.

2
core/ast/src/lib.rs

@ -115,7 +115,7 @@ pub(crate) trait ToJsString {
}
impl ToJsString for Sym {
#[allow(clippy::cast_possible_truncation)]
#[expect(clippy::cast_possible_truncation)]
fn to_js_string(&self, interner: &Interner) -> JsString {
// TODO: Identify latin1 encodeable strings during parsing to avoid this check.
let string = interner.resolve_expect(*self).utf16();

8
core/ast/src/scope.rs

@ -7,7 +7,7 @@ use rustc_hash::FxHashMap;
use std::{cell::RefCell, fmt::Debug, rc::Rc};
#[derive(Clone, Debug, PartialEq)]
#[allow(clippy::struct_excessive_bools)]
#[expect(clippy::struct_excessive_bools)]
struct Binding {
index: u32,
mutable: bool,
@ -126,7 +126,7 @@ impl Scope {
/// Returns the number of bindings in this scope.
#[must_use]
#[allow(clippy::cast_possible_truncation)]
#[expect(clippy::cast_possible_truncation)]
pub fn num_bindings(&self) -> u32 {
self.inner.bindings.borrow().len() as u32
}
@ -196,7 +196,7 @@ impl Scope {
/// Creates a mutable binding.
#[must_use]
#[allow(clippy::cast_possible_truncation)]
#[expect(clippy::cast_possible_truncation)]
pub fn create_mutable_binding(&self, name: JsString, function_scope: bool) -> BindingLocator {
let binding_index = self.inner.bindings.borrow().len() as u32;
self.inner.bindings.borrow_mut().insert(
@ -213,7 +213,7 @@ impl Scope {
}
/// Crate an immutable binding.
#[allow(clippy::cast_possible_truncation)]
#[expect(clippy::cast_possible_truncation)]
pub(crate) fn create_immutable_binding(&self, name: JsString, strict: bool) {
let binding_index = self.inner.bindings.borrow().len() as u32;
self.inner.bindings.borrow_mut().insert(

7
core/ast/src/scope_analyzer.rs

@ -1100,7 +1100,7 @@ impl<'ast> VisitorMut<'ast> for BindingCollectorVisitor<'_> {
}
impl BindingCollectorVisitor<'_> {
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn visit_function_like(
&mut self,
body: &mut FunctionBody,
@ -1469,7 +1469,7 @@ fn function_declaration_instantiation(
// 27. If hasParameterExpressions is false, then
// 28. Else,
#[allow(unused_variables, unused_mut)]
#[expect(unused_mut)]
let (mut instantiated_var_names, mut var_env) = if has_parameter_expressions {
// a. NOTE: A separate Environment Record is needed to ensure that closures created by
// expressions in the formal parameter list do not have
@ -1713,13 +1713,12 @@ pub struct EvalDeclarationBindings {
///
/// * Returns a syntax error if a duplicate lexical declaration is found.
/// * Returns a syntax error if a variable declaration in an eval function already exists as a lexical variable.
#[allow(clippy::missing_panics_doc)]
pub(crate) fn eval_declaration_instantiation_scope(
body: &Script,
strict: bool,
var_env: &Scope,
lex_env: &Scope,
#[allow(unused_variables)] annex_b_function_names: &[Identifier],
annex_b_function_names: &[Identifier],
interner: &Interner,
) -> Result<EvalDeclarationBindings, String> {
let mut result = EvalDeclarationBindings::default();

4
core/ast/src/visitor.rs

@ -89,7 +89,7 @@ macro_rules! node_ref {
) => {
/// A reference to a node visitable by a [`Visitor`].
#[derive(Debug, Clone, Copy)]
#[allow(missing_docs)]
#[expect(missing_docs)]
pub enum NodeRef<'a> {
$(
$Variant(&'a $Variant)
@ -106,7 +106,7 @@ macro_rules! node_ref {
/// A mutable reference to a node visitable by a [`VisitorMut`].
#[derive(Debug)]
#[allow(missing_docs)]
#[expect(missing_docs)]
pub enum NodeRefMut<'a> {
$(
$Variant(&'a mut $Variant)

2402
core/engine/output.rs

File diff suppressed because it is too large Load Diff

11
core/engine/src/builtins/array/mod.rs

@ -231,7 +231,7 @@ impl BuiltInConstructor for Array {
let array = Self::array_create(0, Some(prototype), context)
.expect("this ArrayCreate call must not fail");
// c. If Type(len) is not Number, then
#[allow(clippy::if_not_else)]
#[expect(clippy::if_not_else)]
let int_len = if !len.is_number() {
// i. Perform ! CreateDataPropertyOrThrow(array, "0", len).
array
@ -441,7 +441,7 @@ impl Array {
///
/// [spec]: https://tc39.es/ecma262/#sec-get-array-@@species
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/@@species
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn get_species(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// 1. Return the this value.
Ok(this.clone())
@ -1032,7 +1032,7 @@ impl Array {
///
/// [spec]: https://tc39.es/ecma262/#sec-array.prototype.tostring
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_string(
this: &JsValue,
_: &[JsValue],
@ -1062,7 +1062,6 @@ impl Array {
///
/// [spec]: https://tc39.es/ecma262/#sec-array.prototype.reverse
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse
#[allow(clippy::else_if_without_else)]
pub(crate) fn reverse(
this: &JsValue,
_: &[JsValue],
@ -1844,7 +1843,7 @@ impl Array {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-flattenintoarray
#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn flatten_into_array(
target: &JsObject,
source: &JsObject,
@ -3504,7 +3503,7 @@ fn array_set_length(
let number_len = new_len_val.to_number(context)?;
// 5. If SameValueZero(newLen, numberLen) is false, throw a RangeError exception.
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
if f64::from(new_len) != number_len {
return Err(JsNativeError::range()
.with_message("bad length for array")

4
core/engine/src/builtins/array_buffer/mod.rs

@ -417,7 +417,7 @@ impl ArrayBuffer {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-arraybuffer.isview
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn is_view(_: &JsValue, args: &[JsValue], _context: &mut Context) -> JsResult<JsValue> {
// 1. If Type(arg) is not Object, return false.
// 2. If arg has a [[ViewedArrayBuffer]] internal slot, return true.
@ -435,7 +435,7 @@ impl ArrayBuffer {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-get-arraybuffer-@@species
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn get_species(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// 1. Return the this value.
Ok(this.clone())

2
core/engine/src/builtins/array_buffer/shared.rs

@ -197,7 +197,7 @@ impl SharedArrayBuffer {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-sharedarraybuffer-@@species
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn get_species(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// 1. Return the this value.
Ok(this.clone())

6
core/engine/src/builtins/bigint/mod.rs

@ -166,7 +166,7 @@ impl BigInt {
///
/// [spec]: https://tc39.es/ecma262/#sec-bigint.prototype.tostring
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/toString
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_string(
this: &JsValue,
args: &[JsValue],
@ -229,7 +229,7 @@ impl BigInt {
///
/// [spec]: https://tc39.es/ecma262/#sec-bigint.asintn
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/asIntN
#[allow(clippy::wrong_self_convention)]
pub(crate) fn as_int_n(
_: &JsValue,
args: &[JsValue],
@ -255,7 +255,7 @@ impl BigInt {
///
/// [spec]: https://tc39.es/ecma262/#sec-bigint.asuintn
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt/asUintN
#[allow(clippy::wrong_self_convention)]
pub(crate) fn as_uint_n(
_: &JsValue,
args: &[JsValue],

2
core/engine/src/builtins/boolean/mod.rs

@ -107,7 +107,7 @@ impl Boolean {
///
/// [spec]: https://tc39.es/ecma262/#sec-boolean-object
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean/toString
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_string(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
let boolean = Self::this_boolean_value(this)?;
Ok(JsValue::new(js_string!(boolean.to_string())))

7
core/engine/src/builtins/builder.rs

@ -17,7 +17,7 @@ use super::{function::ConstructorKind, BuiltInConstructor, IntrinsicObject};
/// Marker for a constructor function.
// TODO: Remove this marker and use `Constructor` directly.
#[allow(dead_code)]
#[expect(dead_code)]
pub(crate) struct Constructor {
prototype: JsObject,
inherits: JsPrototype,
@ -26,7 +26,7 @@ pub(crate) struct Constructor {
/// Marker for a constructor function without a custom prototype for its instances.
// TODO: Remove this marker and use `ConstructorNoProto` directly.
#[allow(dead_code)]
#[expect(dead_code)]
pub(crate) struct ConstructorNoProto;
/// Marker for an ordinary function.
@ -179,7 +179,7 @@ pub(crate) struct BuiltInConstructorWithPrototype<'ctx> {
attributes: Attribute,
}
#[allow(dead_code)]
#[expect(dead_code)]
impl BuiltInConstructorWithPrototype<'_> {
/// Specify how many arguments the constructor function takes.
///
@ -349,7 +349,6 @@ impl BuiltInConstructorWithPrototype<'_> {
/// Specifies the parent prototype which objects created by this constructor inherit from.
///
/// Default is `Object.prototype`.
#[allow(clippy::missing_const_for_fn)]
pub(crate) fn inherits(mut self, prototype: JsPrototype) -> Self {
self.inherits = prototype;
self

4
core/engine/src/builtins/date/mod.rs

@ -322,7 +322,7 @@ impl Date {
///
/// [spec]: https://tc39.es/ecma262/#sec-date.now
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn now(_: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult<JsValue> {
Ok(JsValue::new(context.host_hooks().utc_now()))
}
@ -939,7 +939,7 @@ impl Date {
///
/// [local]: https://tc39.es/ecma262/#sec-date.prototype.sethours
/// [utc]: https://tc39.es/ecma262/#sec-date.prototype.setutchours
#[allow(clippy::many_single_char_names)]
#[expect(clippy::many_single_char_names)]
pub(crate) fn set_hours<const LOCAL: bool>(
this: &JsValue,
args: &[JsValue],

2
core/engine/src/builtins/error/mod.rs

@ -232,7 +232,7 @@ impl Error {
///
/// [spec]: https://tc39.es/ecma262/#sec-error.prototype.tostring
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/toString
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_string(
this: &JsValue,
_: &[JsValue],

6
core/engine/src/builtins/function/arguments.rs

@ -27,7 +27,7 @@ impl UnmappedArguments {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-createunmappedargumentsobject
#[allow(clippy::new_ret_no_self)]
#[expect(clippy::new_ret_no_self)]
pub(crate) fn new(arguments_list: &[JsValue], context: &mut Context) -> JsObject {
// 1. Let len be the number of elements in argumentsList.
let len = arguments_list.len();
@ -202,7 +202,7 @@ impl MappedArguments {
/// Creates a new mapped Arguments exotic object.
///
/// <https://tc39.es/ecma262/#sec-createmappedargumentsobject>
#[allow(clippy::new_ret_no_self)]
#[expect(clippy::new_ret_no_self)]
pub(crate) fn new(
func: &JsObject,
binding_indices: &[Option<u32>],
@ -313,7 +313,7 @@ pub(crate) fn arguments_exotic_get_own_property(
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-arguments-exotic-objects-defineownproperty-p-desc
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
pub(crate) fn arguments_exotic_define_own_property(
obj: &JsObject,
key: &PropertyKey,

4
core/engine/src/builtins/function/bound.rs

@ -99,7 +99,7 @@ impl BoundFunction {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-bound-function-exotic-objects-call-thisargument-argumentslist
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn bound_function_exotic_call(
obj: &JsObject,
argument_count: usize,
@ -137,7 +137,7 @@ fn bound_function_exotic_call(
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-bound-function-exotic-objects-construct-argumentslist-newtarget
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn bound_function_exotic_construct(
function_object: &JsObject,
argument_count: usize,

4
core/engine/src/builtins/function/mod.rs

@ -821,7 +821,7 @@ impl BuiltInFunctionObject {
///
/// [spec]: https://tc39.es/ecma262/#sec-function.prototype.tostring
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toString
#[allow(clippy::wrong_self_convention)]
fn to_string(this: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult<JsValue> {
// 1. Let func be the this value.
let func = this;
@ -887,7 +887,7 @@ impl BuiltInFunctionObject {
Ok(JsValue::ordinary_has_instance(this, args.get_or_undefined(0), context)?.into())
}
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn prototype(_: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
Ok(JsValue::undefined())
}

2
core/engine/src/builtins/function/tests.rs

@ -9,7 +9,7 @@ use crate::{
use boa_macros::js_str;
use indoc::indoc;
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
#[test]
fn arguments_object() {
run_test_actions([

2
core/engine/src/builtins/intl/collator/mod.rs

@ -43,7 +43,7 @@ mod options;
pub(crate) use options::*;
#[derive(Debug, Finalize, JsData)]
#[allow(clippy::struct_field_names)]
#[expect(clippy::struct_field_names)]
pub(crate) struct Collator {
locale: Locale,
collation: Value,

3
core/engine/src/builtins/intl/date_time_format.rs

@ -163,7 +163,6 @@ impl BuiltInConstructor for DateTimeFormat {
///
/// Since `required` and `defaults` differ only in the `any` and `all` variants,
/// we combine both in a single variant `AnyAll`.
#[allow(unused)]
#[derive(Debug, PartialEq)]
pub(crate) enum DateTimeReqs {
Date,
@ -178,7 +177,7 @@ pub(crate) enum DateTimeReqs {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma402/#sec-todatetimeoptions
#[allow(unused)]
#[expect(unused)]
pub(crate) fn to_date_time_options(
options: &JsValue,
required: &DateTimeReqs,

1
core/engine/src/builtins/intl/list_format/mod.rs

@ -280,7 +280,6 @@ impl ListFormat {
}
}
#[allow(clippy::missing_const_for_fn)]
fn value(self) -> String {
match self {
Self::Literal(s) | Self::Element(s) => s,

1
core/engine/src/builtins/intl/number_format/options.rs

@ -360,7 +360,6 @@ impl std::str::FromStr for Unit {
impl ParsableOptionType for Unit {}
#[derive(Debug)]
#[allow(variant_size_differences)] // 40 bytes is not big enough to require moving `Unit` to the heap.
pub(crate) enum UnitFormatOptions {
Decimal,
Percent,

1
core/engine/src/builtins/intl/plural_rules/mod.rs

@ -429,7 +429,6 @@ impl PluralRules {
}
#[derive(Debug)]
#[allow(unused)] // Will be used when we implement `selectRange`
struct ResolvedPlural {
category: PluralCategory,
formatted: Option<FixedDecimal>,

2
core/engine/src/builtins/map/mod.rs

@ -176,7 +176,7 @@ impl Map {
///
/// [spec]: https://tc39.es/ecma262/#sec-get-map-@@species
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/@@species
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn get_species(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// 1. Return the this value.
Ok(this.clone())

6
core/engine/src/builtins/math/mod.rs

@ -695,7 +695,7 @@ impl Math {
///
/// [spec]: https://tc39.es/ecma262/#sec-math.pow
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub(crate) fn pow(_: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult<JsValue> {
// 1. Set base to ? ToNumber(base).
let x = args.get_or_undefined(0).to_number(context)?;
@ -737,7 +737,7 @@ impl Math {
///
/// [spec]: https://tc39.es/ecma262/#sec-math.random
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn random(_: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// NOTE: Each Math.random function created for distinct realms must produce a distinct sequence of values from successive calls.
Ok(rand::random::<f64>().into())
@ -751,7 +751,7 @@ impl Math {
///
/// [spec]: https://tc39.es/ecma262/#sec-math.round
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub(crate) fn round(_: &JsValue, args: &[JsValue], context: &mut Context) -> JsResult<JsValue> {
let num = args
.get_or_undefined(0)

1
core/engine/src/builtins/mod.rs

@ -141,7 +141,6 @@ pub(crate) trait BuiltInObject: IntrinsicObject {
/// assign `"Cplx"` to this constant, making any property inside it accessible from ECMAScript
/// as `Cplx.prop`
// `JsString` can only be const-constructed for static strings.
#[allow(clippy::declare_interior_mutable_const)]
const NAME: JsString;
/// Property attribute flags of the built-in. Check [`Attribute`] for more information.

2
core/engine/src/builtins/number/conversions.rs

@ -1,7 +1,7 @@
/// Converts a 64-bit floating point number to an `i32` according to the [`ToInt32`][ToInt32] algorithm.
///
/// [ToInt32]: https://tc39.es/ecma262/#sec-toint32
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub(crate) fn f64_to_int32(number: f64) -> i32 {
const SIGN_MASK: u64 = 0x8000_0000_0000_0000;
const EXPONENT_MASK: u64 = 0x7FF0_0000_0000_0000;

1
core/engine/src/builtins/number/globals.rs

@ -191,7 +191,6 @@ pub(crate) fn parse_int(_: &JsValue, args: &[JsValue], context: &mut Context) ->
let mut strip_prefix = true;
// 8. If R ≠ 0, then
#[allow(clippy::if_not_else)]
let mut r = if r != 0 {
// a. If R < 2 or R > 36, return NaN.
if !(2..=36).contains(&r) {

30
core/engine/src/builtins/number/mod.rs

@ -214,7 +214,7 @@ impl Number {
///
/// [spec]: https://tc39.es/ecma262/#sec-number.prototype.toexponential
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_exponential(
this: &JsValue,
args: &[JsValue],
@ -259,7 +259,7 @@ impl Number {
///
/// [spec]: https://tc39.es/ecma262/#sec-number.prototype.tofixed
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_fixed(
this: &JsValue,
args: &[JsValue],
@ -300,7 +300,7 @@ impl Number {
///
/// [spec]: https://tc39.es/ecma262/#sec-number.prototype.tolocalestring
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_locale_string(
this: &JsValue,
_: &[JsValue],
@ -408,7 +408,7 @@ impl Number {
///
/// [spec]: https://tc39.es/ecma262/#sec-number.prototype.toprecision
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toPrecision
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_precision(
this: &JsValue,
args: &[JsValue],
@ -533,7 +533,7 @@ impl Number {
}
// https://chromium.googlesource.com/v8/v8/+/refs/heads/master/src/numbers/conversions.cc#1230
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_js_string_radix(mut value: f64, radix: u8) -> JsString {
assert!(radix >= 2);
assert!(radix <= 36);
@ -643,7 +643,6 @@ impl Number {
))
}
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_js_string(x: f64) -> JsString {
let mut buffer = ryu_js::Buffer::new();
js_string!(buffer.format(x).to_string())
@ -659,7 +658,6 @@ impl Number {
///
/// [spec]: https://tc39.es/ecma262/#sec-number.prototype.tostring
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_string(
this: &JsValue,
args: &[JsValue],
@ -740,7 +738,7 @@ impl Number {
///
/// [spec]: https://tc39.es/ecma262/#sec-number.isfinite
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn number_is_finite(
_: &JsValue,
args: &[JsValue],
@ -766,7 +764,7 @@ impl Number {
///
/// [spec]: https://tc39.es/ecma262/#sec-number.isinteger
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn number_is_integer(
_: &JsValue,
args: &[JsValue],
@ -789,7 +787,7 @@ impl Number {
///
/// [spec]: https://tc39.es/ecma262/#sec-isnan-number
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn number_is_nan(
_: &JsValue,
args: &[JsValue],
@ -818,7 +816,7 @@ impl Number {
///
/// [spec]: https://tc39.es/ecma262/#sec-isnan-number
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn is_safe_integer(
_: &JsValue,
args: &[JsValue],
@ -848,7 +846,7 @@ impl Number {
}
/// Checks if the float argument is an integer.
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub(crate) fn is_float_integer(number: f64) -> bool {
number.is_finite() && number.trunc() == number
}
@ -857,7 +855,7 @@ impl Number {
/// x (a Number) and y (a Number). It performs the following steps when called:
///
/// <https://tc39.es/ecma262/#sec-numeric-types-number-equal>
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub(crate) fn equal(x: f64, y: f64) -> bool {
x == y
}
@ -866,7 +864,7 @@ impl Number {
/// x (a Number) and y (a Number). It performs the following steps when called:
///
/// <https://tc39.es/ecma262/#sec-numeric-types-number-sameValue>
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub(crate) fn same_value(a: f64, b: f64) -> bool {
if a.is_nan() && b.is_nan() {
return true;
@ -878,7 +876,7 @@ impl Number {
/// x (a Number) and y (a Number). It performs the following steps when called:
///
/// <https://tc39.es/ecma262/#sec-numeric-types-number-sameValueZero>
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub(crate) fn same_value_zero(x: f64, y: f64) -> bool {
if x.is_nan() && y.is_nan() {
return true;
@ -887,7 +885,7 @@ impl Number {
x == y
}
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub(crate) fn less_than(x: f64, y: f64) -> AbstractRelation {
if x.is_nan() || y.is_nan() {
return AbstractRelation::Undefined;

2
core/engine/src/builtins/object/mod.rs

@ -820,7 +820,6 @@ impl OrdinaryObject {
///
/// [spec]: https://tc39.es/ecma262/#sec-object.prototype.tostring
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
#[allow(clippy::wrong_self_convention)]
pub fn to_string(this: &JsValue, _: &[JsValue], context: &mut Context) -> JsResult<JsValue> {
// 1. If the this value is undefined, return "[object Undefined]".
if this.is_undefined() {
@ -888,7 +887,6 @@ impl OrdinaryObject {
///
/// [spec]: https://tc39.es/ecma262/#sec-object.prototype.tolocalestring
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toLocaleString
#[allow(clippy::wrong_self_convention)]
pub fn to_locale_string(
this: &JsValue,
_: &[JsValue],

4
core/engine/src/builtins/options.rs

@ -200,7 +200,7 @@ pub(crate) enum UnsignedRoundingMode {
impl RoundingMode {
// TODO: remove once confirmed.
#[cfg(feature = "temporal")]
#[allow(dead_code)]
#[expect(dead_code)]
pub(crate) const fn negate(self) -> Self {
use RoundingMode::{
Ceil, Expand, Floor, HalfCeil, HalfEven, HalfExpand, HalfFloor, HalfTrunc, Trunc,
@ -221,7 +221,7 @@ impl RoundingMode {
// TODO: remove once confirmed.
#[cfg(feature = "temporal")]
#[allow(dead_code)]
#[expect(dead_code)]
pub(crate) const fn get_unsigned_round_mode(self, is_negative: bool) -> UnsignedRoundingMode {
use RoundingMode::{
Ceil, Expand, Floor, HalfCeil, HalfEven, HalfExpand, HalfFloor, HalfTrunc, Trunc,

2
core/engine/src/builtins/promise/mod.rs

@ -1549,7 +1549,7 @@ impl Promise {
///
/// [spec]: https://tc39.es/ecma262/#sec-get-promise-@@species
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/@@species
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn get_species(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// 1. Return the this value.
Ok(this.clone())

2
core/engine/src/builtins/promise/tests.rs

@ -13,7 +13,7 @@ fn promise() {
count += 1;
"#}),
TestAction::assert_eq("count", 2),
#[allow(clippy::redundant_closure_for_method_calls)]
#[expect(clippy::redundant_closure_for_method_calls)]
TestAction::inspect_context(|ctx| ctx.run_jobs()),
TestAction::assert_eq("count", 3),
]);

5
core/engine/src/builtins/regexp/mod.rs

@ -421,7 +421,7 @@ impl RegExp {
///
/// [spec]: https://tc39.es/ecma262/#sec-get-regexp-@@species
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/@@species
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn get_species(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// 1. Return the this value.
Ok(this.clone())
@ -1081,7 +1081,7 @@ impl RegExp {
// 30. If R contains any GroupName, then
// 31. Else,
// 33. For each integer i such that 1 ≤ i ≤ n, in ascending order, do
#[allow(clippy::if_not_else)]
#[expect(clippy::if_not_else)]
let (groups, group_names) = if !named_groups.clone().is_empty() {
// a. Let groups be OrdinaryObjectCreate(null).
let groups = JsObject::with_null_proto();
@ -1297,7 +1297,6 @@ impl RegExp {
///
/// [spec]: https://tc39.es/ecma262/#sec-regexp.prototype.tostring
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/toString
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_string(
this: &JsValue,
_: &[JsValue],

2
core/engine/src/builtins/set/mod.rs

@ -208,7 +208,7 @@ impl Set {
///
/// [spec]: https://tc39.es/ecma262/#sec-get-set-@@species
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/@@species
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn get_species(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// 1. Return the this value.
Ok(this.clone())

3
core/engine/src/builtins/string/mod.rs

@ -473,7 +473,6 @@ impl String {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-string.prototype.tostring
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_string(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// 1. Return ? thisStringValue(this value).
Ok(Self::this_string_value(this)?.into())
@ -2757,7 +2756,7 @@ pub(crate) fn get_substitution(
}
// c. If none is found, the replacement text is the String "$<".
#[allow(clippy::if_not_else)]
#[expect(clippy::if_not_else)]
if !found {
result.extend_from_slice(utf16!("$<"));
result.extend_from_slice(&group_name);

1
core/engine/src/builtins/symbol/mod.rs

@ -256,7 +256,6 @@ impl Symbol {
///
/// [spec]: https://tc39.es/ecma262/#sec-symbol.prototype.tostring
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toString
#[allow(clippy::wrong_self_convention)]
pub(crate) fn to_string(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// 1. Let sym be ? thisSymbolValue(this value).
let symbol = Self::this_symbol_value(this)?;

2
core/engine/src/builtins/temporal/calendar/mod.rs

@ -9,7 +9,7 @@ use temporal_rs::components::calendar::Calendar;
// -- `Calendar` Abstract Operations --
/// 12.2.21 `GetTemporalCalendarSlotValueWithISODefault ( item )`
#[allow(unused)]
#[expect(unused)]
pub(crate) fn get_temporal_calendar_slot_value_with_default(
item: &JsObject,
context: &mut Context,

3
core/engine/src/builtins/temporal/mod.rs

@ -54,7 +54,6 @@ pub(crate) fn ns_min_instant() -> JsBigInt {
}
// An enum representing common fields across `Temporal` objects.
#[allow(unused)]
pub(crate) enum DateTimeValues {
Year,
Month,
@ -323,7 +322,7 @@ pub(crate) fn is_partial_temporal_object<'value>(
/// 13.43 `ToPositiveIntegerWithTruncation ( argument )`
#[inline]
#[allow(unused)]
#[expect(unused)]
pub(crate) fn to_positive_integer_with_trunc(
value: &JsValue,
context: &mut Context,

14
core/engine/src/builtins/temporal/now.rs

@ -62,7 +62,7 @@ impl Now {
/// - [ECMAScript specification][spec]
///
/// [spec]: https://tc39.es/proposal-temporal/#sec-temporal.now.timezone
#[allow(clippy::unnecessary_wraps)]
fn time_zone_id(_: &JsValue, _args: &[JsValue], context: &mut Context) -> JsResult<JsValue> {
// 1. Return ! SystemTimeZone().
system_time_zone(context)?
@ -140,32 +140,32 @@ fn clamp_epoc_nanos(ns: JsBigInt) -> JsBigInt {
}
/// 2.3.2 `SystemUTCEpochMilliseconds`
#[allow(unused)]
#[expect(unused)]
fn system_utc_epoch_millis() -> JsResult<f64> {
let now = host_system_utc_epoch_nanoseconds()?;
Ok(now.to_f64().div_euclid(1_000_000_f64).floor())
}
/// 2.3.3 `SystemUTCEpochNanoseconds`
#[allow(unused)]
#[expect(unused)]
fn system_utc_epoch_nanos() -> JsResult<JsBigInt> {
host_system_utc_epoch_nanoseconds()
}
/// `SystemInstant`
#[allow(unused)]
#[expect(unused)]
fn system_instant() {
todo!()
}
/// `SystemDateTime`
#[allow(unused)]
#[expect(unused)]
fn system_date_time() {
todo!()
}
/// `SystemZonedDateTime`
#[allow(unused)]
#[expect(unused)]
fn system_zoned_date_time() {
todo!()
}
@ -176,7 +176,7 @@ fn system_zoned_date_time() {
/// - [ECMAScript specififcation][spec]
///
/// [spec]: https://tc39.es/proposal-temporal/#sec-temporal-systemtimezone
#[allow(unused)]
#[expect(unused)]
fn system_time_zone(context: &mut Context) -> JsResult<TimeZone> {
// 1. Let identifier be ! DefaultTimeZone().
let identifier = default_time_zone(context);

2
core/engine/src/builtins/temporal/options.rs

@ -63,7 +63,7 @@ pub(crate) fn get_difference_settings(
}
#[derive(Debug, Clone, Copy)]
#[allow(unused)]
#[expect(unused)]
pub(crate) enum TemporalUnitGroup {
Date, // Need to assert if this is neede anymore with the removal of `Temporal.Calendar`
Time,

2
core/engine/src/builtins/temporal/time_zone/mod.rs

@ -19,7 +19,7 @@ use crate::{builtins::temporal::to_zero_padded_decimal_string, Context};
/// - [ECMAScript specififcation][spec]
///
/// [spec]: https://tc39.es/proposal-temporal/#sec-defaulttimezone
#[allow(unused)]
#[expect(unused)]
pub(super) fn default_time_zone(context: &mut Context) -> String {
// The minimum implementation of DefaultTimeZone for ECMAScript implementations that do not
// include the ECMA-402 API, supporting only the "UTC" time zone, performs the following steps

5
core/engine/src/builtins/typed_array/builtin.rs

@ -352,7 +352,7 @@ impl BuiltinTypedArray {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-get-%typedarray%-@@species
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(super) fn get_species(this: &JsValue, _: &[JsValue], _: &mut Context) -> JsResult<JsValue> {
// 1. Return the this value.
Ok(this.clone())
@ -1553,7 +1553,6 @@ impl BuiltinTypedArray {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse
#[allow(clippy::float_cmp)]
pub(crate) fn reverse(
this: &JsValue,
_: &[JsValue],
@ -2596,7 +2595,7 @@ impl BuiltinTypedArray {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-get-%typedarray%.prototype-@@tostringtag
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn to_string_tag(
this: &JsValue,
_: &[JsValue],

3
core/engine/src/builtins/typed_array/element/mod.rs

@ -250,8 +250,7 @@ macro_rules! element {
to_be: $to_be:expr,
to_le: $to_le:expr $(,)?
) => {
#[allow(clippy::redundant_closure_call)]
#[allow(clippy::undocumented_unsafe_blocks)] // Invariants are checked by the caller.
#[expect(clippy::undocumented_unsafe_blocks)] // Invariants are checked by the caller.
impl Element for $element {
type Atomic = $atomic;

2
core/engine/src/builtins/typed_array/mod.rs

@ -515,7 +515,7 @@ impl TypedArrayElement {
/// This is guaranteed to never fail, since all numeric types supported by JS are less than
/// 8 bytes long.
pub(crate) fn to_bits(self) -> u64 {
#[allow(clippy::cast_lossless)]
#[expect(clippy::cast_lossless)]
match self {
TypedArrayElement::Int8(num) => num as u64,
TypedArrayElement::Uint8(num) => num as u64,

2
core/engine/src/builtins/typed_array/object.rs

@ -563,7 +563,7 @@ pub(crate) fn typed_array_exotic_delete(
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-typedarray-ownpropertykeys
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn typed_array_exotic_own_property_keys(
obj: &JsObject,
_context: &mut Context,

4
core/engine/src/builtins/uri/mod.rs

@ -362,7 +362,7 @@ where
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-decode
#[allow(clippy::many_single_char_names)]
#[expect(clippy::many_single_char_names)]
fn decode<F>(string: &JsString, reserved_set: F) -> JsResult<JsString>
where
F: Fn(u16) -> bool,
@ -387,7 +387,7 @@ where
let c = string.get_expect(k);
// c. If C is not the code unit 0x0025 (PERCENT SIGN), then
#[allow(clippy::if_not_else)]
#[expect(clippy::if_not_else)]
let s = if c != 0x0025_u16 {
// i. Let S be the String value containing only the code unit C.
Vec::from([c])

54
core/engine/src/bytecompiler/declarations.rs

@ -3,6 +3,7 @@ use crate::{
vm::{BindingOpcode, Opcode},
Context, JsNativeError, JsResult,
};
use boa_ast::operations::annex_b_function_declarations_names;
use boa_ast::{
declaration::Binding,
expression::Identifier,
@ -19,9 +20,6 @@ use boa_ast::{
};
use boa_interner::{JStrRef, Sym};
#[cfg(feature = "annex-b")]
use boa_ast::operations::annex_b_function_declarations_names;
use super::{Operand, ToJsString};
/// `GlobalDeclarationInstantiation ( script, env )`
@ -33,34 +31,16 @@ use super::{Operand, ToJsString};
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-globaldeclarationinstantiation
#[cfg(not(feature = "annex-b"))]
#[allow(clippy::unnecessary_wraps)]
#[allow(clippy::ptr_arg)]
pub(crate) fn global_declaration_instantiation_context(
_annex_b_function_names: &mut Vec<Identifier>,
_script: &Script,
_env: &Scope,
_context: &mut Context,
) -> JsResult<()> {
Ok(())
}
/// `GlobalDeclarationInstantiation ( script, env )`
///
/// This diverges from the specification by separating the context from the compilation process.
/// Many steps are skipped that are done during bytecode compilation.
///
/// More information:
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-globaldeclarationinstantiation
#[cfg(feature = "annex-b")]
pub(crate) fn global_declaration_instantiation_context(
annex_b_function_names: &mut Vec<Identifier>,
script: &Script,
env: &Scope,
context: &mut Context,
) -> JsResult<()> {
if cfg!(not(feature = "annex-b")) {
return Ok(());
}
// SKIP: 1. Let lexNames be the LexicallyDeclaredNames of script.
// SKIP: 2. Let varNames be the VarDeclaredNames of script.
// SKIP: 3. For each element name of lexNames, do
@ -198,11 +178,11 @@ pub(crate) fn global_declaration_instantiation_context(
///
/// [spec]: https://tc39.es/ecma262/#sec-evaldeclarationinstantiation
pub(crate) fn eval_declaration_instantiation_context(
#[allow(unused, clippy::ptr_arg)] annex_b_function_names: &mut Vec<Identifier>,
annex_b_function_names: &mut Vec<Identifier>,
body: &Script,
#[allow(unused)] strict: bool,
#[allow(unused)] var_env: &Scope,
#[allow(unused)] lex_env: &Scope,
strict: bool,
var_env: &Scope,
lex_env: &Scope,
context: &mut Context,
) -> JsResult<()> {
// SKIP: 3. If strict is false, then
@ -234,18 +214,19 @@ pub(crate) fn eval_declaration_instantiation_context(
.into());
}
if cfg!(not(feature = "annex-b")) {
return Ok(());
}
// 2. Let varDeclarations be the VarScopedDeclarations of body.
#[cfg(feature = "annex-b")]
let var_declarations = var_scoped_declarations(body);
// SKIP: 8. Let functionsToInitialize be a new empty List.
// 9. Let declaredFunctionNames be a new empty List.
#[cfg(feature = "annex-b")]
let mut declared_function_names = Vec::new();
// 10. For each element d of varDeclarations, in reverse List order, do
#[cfg(feature = "annex-b")]
for declaration in var_declarations.iter().rev() {
// a. If d is not either a VariableDeclaration, a ForBinding, or a BindingIdentifier, then
// a.i. Assert: d is either a FunctionDeclaration, a GeneratorDeclaration, an AsyncFunctionDeclaration, or an AsyncGeneratorDeclaration.
@ -272,7 +253,6 @@ pub(crate) fn eval_declaration_instantiation_context(
// 11. NOTE: Annex B.3.2.3 adds additional steps at this point.
// 11. If strict is false, then
#[cfg(feature = "annex-b")]
if !strict {
let lexically_declared_names = lexically_declared_names(body);
@ -608,7 +588,7 @@ impl ByteCompiler<'_> {
pub(crate) fn eval_declaration_instantiation(
&mut self,
body: &Script,
#[allow(unused_variables)] strict: bool,
strict: bool,
var_env: &Scope,
bindings: EvalDeclarationBindings,
) {
@ -1049,8 +1029,7 @@ impl ByteCompiler<'_> {
// 27. If hasParameterExpressions is false, then
// 28. Else,
#[allow(unused_variables, unused_mut)]
let (mut instantiated_var_names, mut variable_scope) =
let (instantiated_var_names, variable_scope) =
if let Some(scope) = scopes.parameters_scope() {
// a. NOTE: A separate Environment Record is needed to ensure that closures created by
// expressions in the formal parameter list do not have
@ -1060,7 +1039,7 @@ impl ByteCompiler<'_> {
let scope_index = self.push_scope(scope);
self.emit_with_varying_operand(Opcode::PushScope, scope_index);
let mut variable_scope = self.lexical_scope.clone();
let variable_scope = self.lexical_scope.clone();
// d. Let instantiatedVarNames be a new empty List.
let mut instantiated_var_names = Vec::new();
@ -1136,6 +1115,7 @@ impl ByteCompiler<'_> {
// 29. If strict is false, then
#[cfg(feature = "annex-b")]
if !strict {
let mut instantiated_var_names = instantiated_var_names;
// a. For each FunctionDeclaration f that is directly contained in the StatementList
// of a Block, CaseClause, or DefaultClause, do
for f in annex_b_function_declarations_names(body) {

2
core/engine/src/bytecompiler/function.rs

@ -14,7 +14,7 @@ use boa_interner::Interner;
/// `FunctionCompiler` is used to compile AST functions to bytecode.
#[derive(Debug, Clone)]
#[allow(clippy::struct_excessive_bools)]
#[expect(clippy::struct_excessive_bools)]
pub(crate) struct FunctionCompiler {
name: JsString,
generator: bool,

15
core/engine/src/bytecompiler/mod.rs

@ -356,7 +356,7 @@ impl Access<'_> {
/// An opcode operand.
#[derive(Debug, Clone, Copy)]
#[allow(unused)]
#[expect(unused)]
pub(crate) enum Operand {
Bool(bool),
I8(i8),
@ -372,7 +372,6 @@ pub(crate) enum Operand {
/// The [`ByteCompiler`] is used to compile ECMAScript AST from [`boa_ast`] to bytecode.
#[derive(Debug)]
#[allow(clippy::struct_excessive_bools)]
pub struct ByteCompiler<'ctx> {
/// Name of this function.
pub(crate) function_name: JsString,
@ -444,8 +443,8 @@ impl<'ctx> ByteCompiler<'ctx> {
/// Creates a new [`ByteCompiler`].
#[inline]
#[allow(clippy::too_many_arguments)]
#[allow(clippy::fn_params_excessive_bools)]
#[expect(clippy::too_many_arguments)]
#[expect(clippy::fn_params_excessive_bools)]
pub(crate) fn new(
name: JsString,
strict: bool,
@ -685,12 +684,12 @@ impl<'ctx> ByteCompiler<'ctx> {
}
/// TODO: Temporary function, remove once transition is complete.
#[allow(unused)]
#[expect(unused)]
fn pop_into_register(&mut self, dst: &Register) {
self.emit(Opcode::PopIntoRegister, &[Operand::Varying(dst.index())]);
}
/// TODO: Temporary function, remove once transition is complete.
#[allow(unused)]
#[expect(unused)]
fn push_from_register(&mut self, src: &Register) {
self.emit(Opcode::PushFromRegister, &[Operand::Varying(src.index())]);
}
@ -860,7 +859,7 @@ impl<'ctx> ByteCompiler<'ctx> {
} else {
let f32_value = value as f32;
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
if f64::from(f32_value) == value {
self.emit(Opcode::PushFloat, &[Operand::U32(f32_value.to_bits())]);
} else {
@ -1448,7 +1447,6 @@ impl<'ctx> ByteCompiler<'ctx> {
}
/// Compile a [`Declaration`].
#[allow(unused_variables)]
pub fn compile_decl(&mut self, decl: &Declaration, block: bool) {
match decl {
#[cfg(feature = "annex-b")]
@ -1746,7 +1744,6 @@ impl<'ctx> ByteCompiler<'ctx> {
/// Finish compiling code with the [`ByteCompiler`] and return the generated [`CodeBlock`].
#[inline]
#[must_use]
#[allow(clippy::missing_const_for_fn)]
pub fn finish(mut self) -> CodeBlock {
// Push return at the end of the function compilation.
if let Some(async_handler) = self.async_handler {

2
core/engine/src/bytecompiler/module.rs

@ -26,7 +26,7 @@ impl ByteCompiler<'_> {
// 1. Return empty.
}
ModuleItem::ExportDeclaration(export) => {
#[allow(clippy::match_same_arms)]
#[expect(clippy::match_same_arms)]
match export {
ExportDeclaration::ReExport { .. } | ExportDeclaration::List(_) => {
// ExportDeclaration :

2
core/engine/src/bytecompiler/register.rs

@ -108,7 +108,7 @@ impl RegisterAllocator {
reg
}
#[allow(unused)]
#[expect(unused)]
pub(crate) fn dealloc(&mut self, reg: Register) {
assert!(
!reg.flags.is_persistent(),

1
core/engine/src/bytecompiler/statement/continue.rs

@ -5,7 +5,6 @@ use crate::bytecompiler::{
use boa_ast::statement::Continue;
impl ByteCompiler<'_> {
#[allow(clippy::unnecessary_wraps)]
pub(crate) fn compile_continue(&mut self, node: Continue, _use_expr: bool) {
let actions = self.continue_jump_record_actions(node);

2
core/engine/src/class.rs

@ -138,7 +138,7 @@ pub trait Class: NativeObject + Sized {
///
/// Useful to initialize additional properties for the constructed object that aren't
/// stored inside the native data.
#[allow(unused_variables)] // Saves work when IDEs autocomplete trait impls.
#[expect(unused_variables)] // Saves work when IDEs autocomplete trait impls.
fn object_constructor(
instance: &JsObject,
args: &[JsValue],

4
core/engine/src/context/mod.rs

@ -182,7 +182,6 @@ impl Context {
///
/// Note that this won't run any scheduled promise jobs; you need to call [`Context::run_jobs`]
/// on the context or [`JobQueue::run_jobs`] on the provided queue to run them.
#[allow(clippy::unit_arg, dropping_copy_types)]
pub fn eval<R: ReadChar>(&mut self, src: Source<'_, R>) -> JsResult<JsValue> {
let main_timer = Profiler::global().start_event("Script evaluation", "Main");
@ -482,7 +481,7 @@ impl Context {
/// Concurrent job execution cannot be guaranteed by the engine, since this depends on the
/// specific handling of each [`JobQueue`]. If you want to execute jobs concurrently, you must
/// provide a custom implementor of `JobQueue` to the context.
#[allow(clippy::future_not_send)]
#[expect(clippy::future_not_send)]
pub async fn run_jobs_async(&mut self) {
self.job_queue().run_jobs_async(self).await;
self.clear_kept_objects();
@ -922,7 +921,6 @@ impl ContextBuilder {
/// This is useful when you want to initialize an [`Interner`] with
/// a collection of words before parsing.
#[must_use]
#[allow(clippy::missing_const_for_fn)]
pub fn interner(mut self, interner: Interner) -> Self {
self.interner = Some(interner);
self

2
core/engine/src/host_defined.rs

@ -9,7 +9,7 @@ use crate::object::NativeObject;
///
/// This allows storing types which are mapped by their [`TypeId`].
#[derive(Default, Trace, Finalize)]
#[allow(missing_debug_implementations)]
#[expect(missing_debug_implementations)]
pub struct HostDefined {
// INVARIANT: All key-value pairs `(id, obj)` satisfy:
// `id == TypeId::of::<T>() && obj.is::<T>()`

2
core/engine/src/job.rs

@ -65,7 +65,7 @@ pub type FutureJob = Pin<Box<dyn Future<Output = NativeJob> + 'static>>;
/// [Job]: https://tc39.es/ecma262/#sec-jobs
/// [`NativeFunction`]: crate::native_function::NativeFunction
pub struct NativeJob {
#[allow(clippy::type_complexity)]
#[expect(clippy::type_complexity)]
f: Box<dyn FnOnce(&mut Context) -> JsResult<JsValue>>,
realm: Option<Realm>,
}

2
core/engine/src/module/loader.rs

@ -168,7 +168,7 @@ pub trait ModuleLoader {
///
/// [spec]: https://tc39.es/ecma262/#sec-HostLoadImportedModule
/// [finish]: https://tc39.es/ecma262/#sec-FinishLoadingImportedModule
#[allow(clippy::type_complexity)]
#[expect(clippy::type_complexity)]
fn load_imported_module(
&self,
referrer: Referrer,

5
core/engine/src/module/mod.rs

@ -281,7 +281,7 @@ impl Module {
/// that will resolve when the loading process either completes or fails.
///
/// [spec]: https://tc39.es/ecma262/#table-abstract-methods-of-module-records
#[allow(clippy::missing_panics_doc)]
#[expect(clippy::missing_panics_doc)]
#[inline]
pub fn load(&self, context: &mut Context) -> JsPromise {
match self.kind() {
@ -393,7 +393,6 @@ impl Module {
/// This must only be called if the [`JsPromise`] returned by [`Module::load`] has fulfilled.
///
/// [spec]: https://tc39.es/ecma262/#table-abstract-methods-of-module-records
#[allow(clippy::mutable_key_type)]
pub(crate) fn resolve_export(
&self,
export_name: JsString,
@ -418,7 +417,6 @@ impl Module {
/// This must only be called if the [`JsPromise`] returned by [`Module::load`] has fulfilled.
///
/// [spec]: https://tc39.es/ecma262/#table-abstract-methods-of-module-records
#[allow(clippy::missing_panics_doc)]
#[inline]
pub fn link(&self, context: &mut Context) -> JsResult<()> {
match self.kind() {
@ -531,7 +529,6 @@ impl Module {
/// PromiseState::Fulfilled(JsValue::undefined())
/// );
/// ```
#[allow(dropping_copy_types)]
#[inline]
pub fn load_link_evaluate(&self, context: &mut Context) -> JsPromise {
let main_timer = Profiler::global().start_event("Module evaluation", "Main");

10
core/engine/src/module/namespace.rs

@ -95,7 +95,7 @@ impl ModuleNamespace {
/// [`[[GetPrototypeOf]] ( )`][spec].
///
/// [spec]: https://tc39.es/ecma262/#sec-module-namespace-exotic-objects-getprototypeof
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn module_namespace_exotic_get_prototype_of(
_: &JsObject,
_: &mut Context,
@ -107,7 +107,7 @@ fn module_namespace_exotic_get_prototype_of(
/// [`[[SetPrototypeOf]] ( V )`][spec].
///
/// [spec]: https://tc39.es/ecma262/#sec-module-namespace-exotic-objects-setprototypeof-v
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn module_namespace_exotic_set_prototype_of(
obj: &JsObject,
val: JsPrototype,
@ -123,7 +123,7 @@ fn module_namespace_exotic_set_prototype_of(
/// [`[[IsExtensible]] ( )`][spec].
///
/// [spec]: https://tc39.es/ecma262/#sec-module-namespace-exotic-objects-isextensible
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn module_namespace_exotic_is_extensible(_: &JsObject, _: &mut Context) -> JsResult<bool> {
// 1. Return false.
Ok(false)
@ -132,7 +132,7 @@ fn module_namespace_exotic_is_extensible(_: &JsObject, _: &mut Context) -> JsRes
/// [`[[PreventExtensions]] ( )`][spec].
///
/// [spec]: https://tc39.es/ecma262/#sec-module-namespace-exotic-objects-preventextensions
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn module_namespace_exotic_prevent_extensions(_: &JsObject, _: &mut Context) -> JsResult<bool> {
Ok(true)
}
@ -414,7 +414,7 @@ fn module_namespace_exotic_get(
/// [`[[Set]] ( P, V, Receiver )`][spec].
///
/// [spec]: https://tc39.es/ecma262/#sec-module-namespace-exotic-objects-set-p-v-receiver
#[allow(clippy::needless_pass_by_value, clippy::unnecessary_wraps)]
#[expect(clippy::needless_pass_by_value, clippy::unnecessary_wraps)]
fn module_namespace_exotic_set(
_obj: &JsObject,
_key: PropertyKey,

3
core/engine/src/module/source.rs

@ -520,7 +520,6 @@ impl SourceTextModule {
/// Concrete method [`ResolveExport ( exportName [ , resolveSet ] )`][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-resolveexport
#[allow(clippy::mutable_key_type)]
pub(super) fn resolve_export(
&self,
module_self: &Module,
@ -1309,7 +1308,6 @@ impl SourceTextModule {
/// Abstract operation [`GatherAvailableAncestors ( module, execList )`][spec].
///
/// [spec]: https://tc39.es/ecma262/#sec-gather-available-ancestors
#[allow(clippy::mutable_key_type)]
fn gather_available_ancestors(&self, exec_list: &mut FxHashSet<Module>) {
// 1. For each Cyclic Module Record m of module.[[AsyncParentModules]], do
for m in &*self.async_parent_modules.borrow() {
@ -1788,7 +1786,6 @@ impl SourceTextModule {
/// Abstract operation [`AsyncModuleExecutionFulfilled ( module )`][spec].
///
/// [spec]: https://tc39.es/ecma262/#sec-async-module-execution-fulfilled
#[allow(clippy::mutable_key_type)]
fn async_module_execution_fulfilled(module: &Module, context: &mut Context) {
let ModuleKind::SourceText(module_src) = module.kind() else {
unreachable!("async executed module must be a source text module");

1
core/engine/src/module/synthetic.rs

@ -249,7 +249,6 @@ impl SyntheticModule {
/// Concrete method [`ResolveExport ( exportName )`][spec]
///
/// [spec]: https://tc39.es/proposal-json-modules/#sec-smr-resolveexport
#[allow(clippy::mutable_key_type)]
pub(super) fn resolve_export(
&self,
module_self: &Module,

4
core/engine/src/object/builtins/jsarray.rs

@ -177,7 +177,7 @@ impl JsArray {
.as_number()
.expect("Array.prototype.indexOf should always return number");
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
if index == -1.0 {
Ok(None)
} else {
@ -203,7 +203,7 @@ impl JsArray {
.as_number()
.expect("Array.prototype.lastIndexOf should always return number");
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
if index == -1.0 {
Ok(None)
} else {

6
core/engine/src/object/builtins/jspromise.rs

@ -483,7 +483,7 @@ impl JsPromise {
///
/// [`Promise.prototype.then`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then
#[inline]
#[allow(clippy::return_self_not_must_use)] // Could just be used to add handlers on an existing promise
#[expect(clippy::return_self_not_must_use)] // Could just be used to add handlers on an existing promise
pub fn then(
&self,
on_fulfilled: Option<JsFunction>,
@ -546,7 +546,7 @@ impl JsPromise {
/// [`Promise.prototype.catch`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
/// [then]: JsPromise::then
#[inline]
#[allow(clippy::return_self_not_must_use)] // Could just be used to add a handler on an existing promise
#[expect(clippy::return_self_not_must_use)] // Could just be used to add a handler on an existing promise
pub fn catch(&self, on_rejected: JsFunction, context: &mut Context) -> Self {
self.then(None, Some(on_rejected), context)
}
@ -618,7 +618,7 @@ impl JsPromise {
/// [`Promise.prototype.finally()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally
/// [then]: JsPromise::then
#[inline]
#[allow(clippy::return_self_not_must_use)] // Could just be used to add a handler on an existing promise
#[expect(clippy::return_self_not_must_use)] // Could just be used to add a handler on an existing promise
pub fn finally(&self, on_finally: JsFunction, context: &mut Context) -> Self {
let (then, catch) = Promise::then_catch_finally_closures(
context.intrinsics().constructors().promise().constructor(),

4
core/engine/src/object/builtins/jstypedarray.rs

@ -765,7 +765,7 @@ impl JsTypedArray {
.as_number()
.expect("TypedArray.prototype.indexOf should always return number");
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
if index == -1.0 {
Ok(None)
} else {
@ -791,7 +791,7 @@ impl JsTypedArray {
.as_number()
.expect("TypedArray.prototype.lastIndexOf should always return number");
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
if index == -1.0 {
Ok(None)
} else {

2
core/engine/src/object/internal_methods/immutable_prototype.rs

@ -17,7 +17,7 @@ pub(crate) static IMMUTABLE_PROTOTYPE_EXOTIC_INTERNAL_METHODS: InternalObjectMet
/// [`[[SetPrototypeOf]] ( V )`][spec].
///
/// [spec]: https://tc39.es/ecma262/#sec-immutable-prototype-exotic-objects-setprototypeof-v
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
pub(crate) fn immutable_prototype_exotic_set_prototype_of(
obj: &JsObject,
val: JsPrototype,

14
core/engine/src/object/internal_methods/mod.rs

@ -345,7 +345,7 @@ pub(crate) static ORDINARY_INTERNAL_METHODS: InternalObjectMethods = InternalObj
///
/// For a guide on how to implement exotic internal methods, see `ORDINARY_INTERNAL_METHODS`.
#[derive(Debug, Clone, Copy)]
#[allow(clippy::type_complexity, clippy::struct_field_names)]
#[expect(clippy::struct_field_names)]
pub struct InternalObjectMethods {
pub(crate) __get_prototype_of__: fn(&JsObject, &mut Context) -> JsResult<JsPrototype>,
pub(crate) __set_prototype_of__: fn(&JsObject, JsPrototype, &mut Context) -> JsResult<bool>,
@ -431,7 +431,7 @@ impl CallValue {
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-ordinarygetprototypeof
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn ordinary_get_prototype_of(
obj: &JsObject,
_context: &mut Context,
@ -448,7 +448,7 @@ pub(crate) fn ordinary_get_prototype_of(
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-ordinarysetprototypeof
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn ordinary_set_prototype_of(
obj: &JsObject,
val: JsPrototype,
@ -504,7 +504,7 @@ pub(crate) fn ordinary_set_prototype_of(
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-ordinaryisextensible
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn ordinary_is_extensible(obj: &JsObject, _context: &mut Context) -> JsResult<bool> {
// 1. Return O.[[Extensible]].
Ok(obj.borrow().extensible)
@ -516,7 +516,7 @@ pub(crate) fn ordinary_is_extensible(obj: &JsObject, _context: &mut Context) ->
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-ordinarypreventextensions
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn ordinary_prevent_extensions(
obj: &JsObject,
_context: &mut Context,
@ -534,7 +534,7 @@ pub(crate) fn ordinary_prevent_extensions(
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-ordinarygetownproperty
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn ordinary_get_own_property(
obj: &JsObject,
key: &PropertyKey,
@ -878,7 +878,7 @@ pub(crate) fn ordinary_delete(
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-ordinaryownpropertykeys
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn ordinary_own_property_keys(
obj: &JsObject,
_context: &mut Context,

2
core/engine/src/object/internal_methods/string.rs

@ -81,7 +81,7 @@ pub(crate) fn string_exotic_define_own_property(
/// - [ECMAScript reference][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-string-exotic-objects-ownpropertykeys
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
pub(crate) fn string_exotic_own_property_keys(
obj: &JsObject,
_context: &mut Context,

5
core/engine/src/object/jsobject.rs

@ -63,7 +63,6 @@ impl<T: NativeObject + ?Sized> Clone for JsObject<T> {
// We have to skip implementing `Debug` for this because not using the
// implementation of `Debug` for `JsObject` could easily cause stack overflows,
// so we have to force our users to debug the `JsObject` instead.
#[allow(missing_debug_implementations)]
#[derive(Trace, Finalize)]
pub(crate) struct VTableObject<T: NativeObject + ?Sized> {
#[unsafe_ignore_trace]
@ -527,7 +526,7 @@ Cannot both specify accessors and a value or writable attribute",
}
// Allow lint, false positive.
#[allow(clippy::assigning_clones)]
#[expect(clippy::assigning_clones)]
pub(crate) fn get_property(&self, key: &PropertyKey) -> Option<PropertyDescriptor> {
let mut obj = Some(self.clone());
@ -714,7 +713,7 @@ impl<T: NativeObject + ?Sized> JsObject<T> {
/// Panics if the object is currently mutably borrowed
#[inline]
#[track_caller]
#[allow(clippy::must_use_candidate)]
#[expect(clippy::must_use_candidate)]
pub fn set_prototype(&self, prototype: JsPrototype) -> bool {
self.borrow_mut().set_prototype(prototype)
}

2
core/engine/src/object/operations.rs

@ -842,7 +842,7 @@ impl JsObject {
/// - [ECMAScript specification][spec]
///
/// [spec]: https://tc39.es/ecma262/#sec-privateelementfind
#[allow(clippy::similar_names)]
#[expect(clippy::similar_names)]
pub(crate) fn private_element_find(
&self,
name: &PrivateName,

1
core/engine/src/object/property_map.rs

@ -860,7 +860,6 @@ impl FusedIterator for IndexPropertyKeys<'_> {}
/// An iterator over the index values (`Property`) of an `Object`.
#[derive(Debug, Clone)]
#[allow(variant_size_differences)]
pub enum IndexPropertyValues<'a> {
/// An iterator over dense, Vec backed indexed property entries of an `Object`.
DenseI32(std::slice::Iter<'a, i32>),

2
core/engine/src/object/shape/shared_shape/mod.rs

@ -37,7 +37,7 @@ const CONFIGURE_PROPERTY_TRANSITION_TYPE: u8 = 0b0000_0001;
const PROTOTYPE_TRANSITION_TYPE: u8 = 0b0000_0010;
// Reserved for future use!
#[allow(unused)]
#[expect(unused)]
const RESEREVED_TRANSITION_TYPE: u8 = 0b0000_0011;
bitflags! {

2
core/engine/src/optimizer/mod.rs

@ -115,7 +115,7 @@ impl<'context> Optimizer<'context> {
pub(crate) fn apply(&mut self, statement_list: &mut StatementList) -> OptimizerStatistics {
self.visit_statement_list_mut(statement_list);
#[allow(clippy::print_stdout)]
#[expect(clippy::print_stdout)]
if self
.context
.optimizer_options()

1
core/engine/src/property/mod.rs

@ -573,7 +573,6 @@ impl PropertyDescriptorBuilder {
/// Consumes the builder and returns the [`PropertyDescriptor`].
#[must_use]
#[allow(clippy::missing_const_for_fn)]
pub fn build(self) -> PropertyDescriptor {
self.inner
}

4
core/engine/src/script.rs

@ -181,7 +181,7 @@ impl Script {
/// This uses an implementation defined amount of "clock cycles" that need to pass before
/// execution is suspended. See [`Script::evaluate_async_with_budget`] if you want to also
/// customize this parameter.
#[allow(clippy::future_not_send)]
#[expect(clippy::future_not_send)]
pub async fn evaluate_async(&self, context: &mut Context) -> JsResult<JsValue> {
self.evaluate_async_with_budget(context, 256).await
}
@ -193,7 +193,7 @@ impl Script {
/// CPU clock cycles a VM instruction will take, but all instructions have a "cost" associated
/// with them that depends on their individual complexity. We'd recommend benchmarking with
/// different budget sizes in order to find the ideal yielding time for your application.
#[allow(clippy::future_not_send)]
#[expect(clippy::future_not_send)]
pub async fn evaluate_async_with_budget(
&self,
context: &mut Context,

5
core/engine/src/small_map/mod.rs

@ -173,7 +173,7 @@ impl<K, V, const ARRAY_SIZE: usize> SmallMap<K, V, ARRAY_SIZE> {
///
/// The supplied key may be any borrowed form of the map's key type, but the ordering
/// on the borrowed form *must* match the ordering on the key type.
#[allow(clippy::map_identity)]
pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&K, &V)>
where
K: Borrow<Q> + Ord + Eq,
@ -372,7 +372,6 @@ impl<'a, K, V, const ARRAY_SIZE: usize> IntoIterator for &'a SmallMap<K, V, ARRA
impl<'a, K, V> Iterator for Iter<'a, K, V> {
type Item = (&'a K, &'a V);
#[allow(clippy::map_identity)]
fn next(&mut self) -> Option<Self::Item> {
match &mut self.inner {
InnerIter::Inline(i) => i.next().map(|(k, v)| (k, v)),
@ -387,7 +386,6 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
}
}
#[allow(clippy::map_identity)]
fn last(self) -> Option<(&'a K, &'a V)> {
match self.inner {
InnerIter::Inline(i) => i.last().map(|(k, v)| (k, v)),
@ -399,7 +397,6 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
impl<K, V> FusedIterator for Iter<'_, K, V> {}
impl<'a, K: 'a, V: 'a> DoubleEndedIterator for Iter<'a, K, V> {
#[allow(clippy::map_identity)]
fn next_back(&mut self) -> Option<(&'a K, &'a V)> {
match &mut self.inner {
InnerIter::Inline(i) => i.next_back().map(|(k, v)| (k, v)),

4
core/engine/src/string.rs

@ -49,7 +49,7 @@ pub use boa_string::*;
/// assert_eq!(&msg, "Hello, human! Nice to meet you!");
/// ```
#[macro_export]
#[allow(clippy::module_name_repetitions)]
#[expect(clippy::module_name_repetitions)]
macro_rules! js_string {
() => {
$crate::string::JsString::default()
@ -70,7 +70,7 @@ macro_rules! js_string {
};
}
#[allow(clippy::redundant_clone)]
#[expect(clippy::redundant_clone)]
#[cfg(test)]
mod tests {
use std::hash::{BuildHasher, BuildHasherDefault, Hash};

2
core/engine/src/symbol.rs

@ -135,7 +135,7 @@ struct Inner {
// Safety: JsSymbol does not contain any objects which needs to be traced,
// so this is safe.
#[boa_gc(unsafe_empty_trace)]
#[allow(clippy::module_name_repetitions)]
#[expect(clippy::module_name_repetitions)]
pub struct JsSymbol {
repr: Tagged<Inner>,
}

6
core/engine/src/tagged.rs

@ -39,7 +39,7 @@ impl<T> Clone for Tagged<T> {
impl<T> Copy for Tagged<T> {}
#[allow(dead_code)]
#[expect(dead_code)]
impl<T> Tagged<T> {
/// Creates a new, tagged `Tagged` pointer from an integer.
///
@ -90,13 +90,13 @@ impl<T> Tagged<T> {
}
/// Gets the address of the inner pointer.
#[allow(unused)]
#[expect(unused)]
pub(crate) fn addr(self) -> usize {
self.0.as_ptr().addr()
}
/// Returns `true` if `self ` is a tagged pointer.
#[allow(unused)]
#[expect(unused)]
pub(crate) fn is_tagged(self) -> bool {
self.0.as_ptr().addr() & 1 > 0
}

6
core/engine/src/tests/iterators.rs

@ -46,7 +46,7 @@ fn iterator_close_in_continue_before_jobs() {
actual.push("async fn end");
}();
"#}),
#[allow(clippy::redundant_closure_for_method_calls)]
#[expect(clippy::redundant_closure_for_method_calls)]
TestAction::inspect_context(|ctx| ctx.run_jobs()),
TestAction::assert(indoc! {r#"
arrayEquals(
@ -110,7 +110,7 @@ fn async_iterator_close_in_continue_is_awaited() {
actual.push("async fn end");
}();
"#}),
#[allow(clippy::redundant_closure_for_method_calls)]
#[expect(clippy::redundant_closure_for_method_calls)]
TestAction::inspect_context(|ctx| ctx.run_jobs()),
TestAction::assert(indoc! {r#"
arrayEquals(
@ -198,7 +198,7 @@ fn mixed_iterators_close_in_continue() {
actual.push("async fn end");
}();
"#}),
#[allow(clippy::redundant_closure_for_method_calls)]
#[expect(clippy::redundant_closure_for_method_calls)]
TestAction::inspect_context(|ctx| ctx.run_jobs()),
TestAction::assert(indoc! {r#"
arrayEquals(

2
core/engine/src/tests/promise.rs

@ -3,7 +3,7 @@ use indoc::indoc;
use crate::{run_test_actions, TestAction};
#[test]
#[allow(clippy::redundant_closure_for_method_calls)]
#[expect(clippy::redundant_closure_for_method_calls)]
fn issue_2658() {
run_test_actions([
TestAction::run(indoc! {

2
core/engine/src/value/conversions/mod.rs

@ -176,7 +176,7 @@ impl From<JsObject> for JsValue {
impl From<()> for JsValue {
#[inline]
#[allow(clippy::pedantic)] // didn't want to increase our MSRV for just a lint.
#[expect(clippy::pedantic)] // didn't want to increase our MSRV for just a lint.
fn from(_: ()) -> Self {
let _timer = Profiler::global().start_event("From<()>", "value");

2
core/engine/src/value/equality.rs

@ -37,7 +37,7 @@ impl JsValue {
///
/// This method is executed when doing abstract equality comparisons with the `==` operator.
/// For more information, check <https://tc39.es/ecma262/#sec-abstract-equality-comparison>
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub fn equals(&self, other: &Self, context: &mut Context) -> JsResult<bool> {
// 1. If Type(x) is the same as Type(y), then
// a. Return the result of performing Strict Equality Comparison x === y.

3
core/engine/src/value/mod.rs

@ -290,7 +290,7 @@ impl JsValue {
///
/// [spec]: https://tc39.es/ecma262/#sec-isintegralnumber
#[must_use]
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub fn is_integral_number(&self) -> bool {
// If it can fit in a i32 and the truncated version is
// equal to the original then it is an integer.
@ -307,7 +307,6 @@ impl JsValue {
///
/// Similar to [`JsValue::is_integral_number()`] except that it returns `false` for `-0`.
#[must_use]
#[allow(clippy::float_cmp)]
pub fn is_integer(&self) -> bool {
// If it can fit in a i32 and the truncated version is
// equal to the original then it is an integer.

2
core/engine/src/value/operations.rs

@ -196,7 +196,7 @@ impl JsValue {
/// Perform the binary `**` operator on the value and return the result.
// NOTE: There are some cases in the spec where we have to compare floats
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
pub fn pow(&self, other: &Self, context: &mut Context) -> JsResult<Self> {
Ok(match (self, other) {
// Fast path:

4
core/engine/src/value/tests.rs

@ -98,7 +98,7 @@ fn hash_value(value: &JsValue) -> u64 {
hasher.finish()
}
#[allow(clippy::redundant_clone)]
#[expect(clippy::redundant_clone)]
#[test]
fn hash_undefined() {
let value1 = JsValue::undefined();
@ -312,7 +312,7 @@ fn bitand_rational_and_rational() {
}
#[test]
#[allow(clippy::float_cmp)]
#[expect(clippy::float_cmp)]
fn pow_number_and_number() {
run_test_actions([TestAction::assert_eq("3 ** 3", 27.0)]);
}

4
core/engine/src/vm/call_frame/mod.rs

@ -355,11 +355,13 @@ impl CallFrame {
/// Indicates how a generator function that has been called/resumed should return.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
#[repr(u8)]
#[allow(missing_docs)]
pub enum GeneratorResumeKind {
#[default]
/// Usual execution.
Normal = 0,
/// Finished by throwing an error.
Throw,
/// Finished by returning.
Return,
}

1
core/engine/src/vm/completion_record.rs

@ -39,7 +39,6 @@ impl CompletionRecord {
// - https://github.com/rust-lang/rust-clippy/issues/4041
// - https://github.com/rust-lang/rust/issues/60964
// - https://github.com/rust-lang/rust/issues/73255
#[allow(clippy::missing_const_for_fn)]
pub(crate) fn consume(self) -> JsResult<JsValue> {
match self {
Self::Throw(error) => Err(error),

2
core/engine/src/vm/flowgraph/color.rs

@ -28,7 +28,7 @@ pub enum Color {
impl Color {
/// Function for converting HSV to RGB color format.
#[allow(clippy::many_single_char_names)]
#[expect(clippy::many_single_char_names)]
#[must_use]
pub fn hsv_to_rgb(h: f64, s: f64, v: f64) -> Self {
let h_i = (h * 6.0) as i64;

2
core/engine/src/vm/flowgraph/mod.rs

@ -17,7 +17,7 @@ use super::{Constant, Instruction, InstructionIterator};
impl CodeBlock {
/// Output the [`CodeBlock`] VM instructions into a [`Graph`].
#[allow(clippy::match_same_arms)]
#[expect(clippy::match_same_arms)]
pub fn to_graph(&self, graph: &mut SubGraph) {
// Have to remove any invalid graph chars like `<` or `>`.
let name = if self.name() == &js_str!("<main>") {

5
core/engine/src/vm/mod.rs

@ -30,7 +30,6 @@ pub mod flowgraph;
pub(crate) use inline_cache::InlineCache;
// TODO: see if this can be exposed on all features.
#[allow(unused_imports)]
pub(crate) use opcode::{Instruction, InstructionIterator, Opcode, VaryingOperandKind};
pub use runtime_limits::RuntimeLimits;
pub use {
@ -277,7 +276,7 @@ pub(crate) enum CompletionType {
Yield,
}
#[allow(clippy::print_stdout)]
#[expect(clippy::print_stdout)]
#[cfg(feature = "trace")]
impl Context {
const COLUMN_WIDTH: usize = 26;
@ -554,7 +553,7 @@ impl Context {
/// Runs the current frame to completion, yielding to the caller each time `budget`
/// "clock cycles" have passed.
#[allow(clippy::future_not_send)]
#[expect(clippy::future_not_send)]
pub(crate) async fn run_async_with_budget(&mut self, budget: u32) -> CompletionRecord {
let _timer = Profiler::global().start_event("run_async_with_budget", "vm");

6
core/engine/src/vm/opcode/control_flow/return.rs

@ -120,8 +120,7 @@ impl Operation for SetReturnValue {
pub(crate) struct PopIntoRegister;
impl PopIntoRegister {
#[allow(clippy::unnecessary_wraps)]
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::unnecessary_wraps)]
fn operation(dst: u32, context: &mut Context) -> JsResult<CompletionType> {
let value = context.vm.pop();
@ -157,8 +156,7 @@ impl Operation for PopIntoRegister {
pub(crate) struct PushFromRegister;
impl PushFromRegister {
#[allow(clippy::unnecessary_wraps)]
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::unnecessary_wraps)]
fn operation(dst: u32, context: &mut Context) -> JsResult<CompletionType> {
let rp = context.vm.frame().rp;
let value = context.vm.stack[(rp + dst) as usize].clone();

4
core/engine/src/vm/opcode/define/mod.rs

@ -17,7 +17,7 @@ pub(crate) use own_property::*;
pub(crate) struct DefVar;
impl DefVar {
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn operation(context: &mut Context, index: usize) -> JsResult<CompletionType> {
// TODO: spec specifies to return `empty` on empty vars, but we're trying to initialize.
let binding_locator = context.vm.frame().code_block.bindings[index].clone();
@ -101,7 +101,7 @@ impl Operation for DefInitVar {
pub(crate) struct PutLexicalValue;
impl PutLexicalValue {
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn operation(context: &mut Context, index: usize) -> JsResult<CompletionType> {
let value = context.vm.pop();
let binding_locator = context.vm.frame().code_block.bindings[index].clone();

2
core/engine/src/vm/opcode/get/argument.rs

@ -11,7 +11,7 @@ use crate::{
pub(crate) struct GetArgument;
impl GetArgument {
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn operation(context: &mut Context, index: usize) -> JsResult<CompletionType> {
let value = context
.vm

2
core/engine/src/vm/opcode/get/function.rs

@ -11,7 +11,7 @@ use crate::{
pub(crate) struct GetFunction;
impl GetFunction {
#[allow(clippy::unnecessary_wraps)]
#[expect(clippy::unnecessary_wraps)]
fn operation(context: &mut Context, index: usize) -> JsResult<CompletionType> {
let code = context.vm.frame().code_block().constant_function(index);
let function = create_function_object_fast(code, context);

2
core/engine/src/vm/opcode/global.rs

@ -129,7 +129,6 @@ impl Operation for CanDeclareGlobalVar {
pub(crate) struct CreateGlobalFunctionBinding;
impl CreateGlobalFunctionBinding {
#[allow(clippy::unnecessary_wraps)]
fn operation(
context: &mut Context,
index: usize,
@ -182,7 +181,6 @@ impl Operation for CreateGlobalFunctionBinding {
pub(crate) struct CreateGlobalVarBinding;
impl CreateGlobalVarBinding {
#[allow(clippy::unnecessary_wraps)]
fn operation(
context: &mut Context,
index: usize,

5
core/engine/src/vm/opcode/locals/mod.rs

@ -11,8 +11,7 @@ use crate::{
pub(crate) struct PopIntoLocal;
impl PopIntoLocal {
#[allow(clippy::unnecessary_wraps)]
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::unnecessary_wraps)]
fn operation(dst: u32, context: &mut Context) -> JsResult<CompletionType> {
context.vm.frame_mut().local_binings_initialized[dst as usize] = true;
let value = context.vm.pop();
@ -52,8 +51,6 @@ impl Operation for PopIntoLocal {
pub(crate) struct PushFromLocal;
impl PushFromLocal {
#[allow(clippy::unnecessary_wraps)]
#[allow(clippy::needless_pass_by_value)]
fn operation(dst: u32, context: &mut Context) -> JsResult<CompletionType> {
if !context.vm.frame().local_binings_initialized[dst as usize] {
return Err(JsNativeError::reference()

6
core/engine/src/vm/opcode/mod.rs

@ -393,7 +393,7 @@ macro_rules! generate_opcodes {
impl From<u8> for Opcode {
#[inline]
#[allow(non_upper_case_globals)]
#[expect(non_upper_case_globals)]
fn from(value: u8) -> Self {
$(
const $Variant: u8 = Opcode::$Variant as u8;
@ -490,7 +490,7 @@ macro_rules! generate_opcodes {
impl Instruction {
/// Convert [`Instruction`] to compact bytecode.
#[inline]
#[allow(dead_code)]
#[expect(dead_code)]
pub(crate) fn to_bytecode(&self, bytes: &mut Vec<u8>) {
match self {
$(
@ -2303,7 +2303,6 @@ pub(crate) struct InstructionIterator<'bytecode> {
}
// TODO: see if this can be exposed on all features.
#[allow(unused)]
impl<'bytecode> InstructionIterator<'bytecode> {
/// Create a new [`InstructionIterator`] from bytecode array.
#[inline]
@ -2315,6 +2314,7 @@ impl<'bytecode> InstructionIterator<'bytecode> {
/// Create a new [`InstructionIterator`] from bytecode array at pc.
#[inline]
#[must_use]
#[allow(unused)]
pub(crate) const fn with_pc(bytes: &'bytecode [u8], pc: usize) -> Self {
Self { bytes, pc }
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save