Browse Source

Fix 1.71.0 lints (#3140)

* Fix 1.71.0 lints

* Attest suggestion
pull/3135/head
João Borges 1 year ago committed by GitHub
parent
commit
93d05bda68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      boa_engine/src/context/mod.rs
  2. 2
      boa_engine/src/module/mod.rs
  3. 5
      boa_engine/src/object/builtins/jsdataview.rs
  4. 4
      boa_examples/src/bin/modulehandler.rs

2
boa_engine/src/context/mod.rs

@ -168,7 +168,7 @@ impl<'host> Context<'host> {
/// ///
/// Note that this won't run any scheduled promise jobs; you need to call [`Context::run_jobs`] /// 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. /// on the context or [`JobQueue::run_jobs`] on the provided queue to run them.
#[allow(clippy::unit_arg, clippy::drop_copy)] #[allow(clippy::unit_arg, dropping_copy_types)]
pub fn eval<R: Read>(&mut self, src: Source<'_, R>) -> JsResult<JsValue> { pub fn eval<R: Read>(&mut self, src: Source<'_, R>) -> JsResult<JsValue> {
let main_timer = Profiler::global().start_event("Script evaluation", "Main"); let main_timer = Profiler::global().start_event("Script evaluation", "Main");

2
boa_engine/src/module/mod.rs

@ -641,7 +641,7 @@ impl Module {
/// ///
/// assert_eq!(promise.state().unwrap(), PromiseState::Fulfilled(JsValue::undefined())); /// assert_eq!(promise.state().unwrap(), PromiseState::Fulfilled(JsValue::undefined()));
/// ``` /// ```
#[allow(clippy::drop_copy)] #[allow(dropping_copy_types)]
#[inline] #[inline]
pub fn load_link_evaluate(&self, context: &mut Context<'_>) -> JsResult<JsPromise> { pub fn load_link_evaluate(&self, context: &mut Context<'_>) -> JsResult<JsPromise> {
let main_timer = Profiler::global().start_event("Module evaluation", "Main"); let main_timer = Profiler::global().start_event("Module evaluation", "Main");

5
boa_engine/src/object/builtins/jsdataview.rs

@ -68,10 +68,7 @@ impl JsDataView {
.into()); .into());
} }
let view_byte_length = if let Some(..) = byte_length { let view_byte_length = if let Some(provided_length) = byte_length {
// Get the provided length
let provided_length = byte_length.expect("byte_length must be a u64");
// Check that the provided length and offset does not exceed the bounds of the ArrayBuffer // Check that the provided length and offset does not exceed the bounds of the ArrayBuffer
if provided_offset + provided_length > array_buffer_length { if provided_offset + provided_length > array_buffer_length {
return Err(JsNativeError::range() return Err(JsNativeError::range()

4
boa_examples/src/bin/modulehandler.rs

@ -49,8 +49,8 @@ fn require(_: &JsValue, args: &[JsValue], ctx: &mut Context<'_>) -> JsResult<JsV
// Read the module source file // Read the module source file
println!("Loading: {libfile}"); println!("Loading: {libfile}");
let buffer = read_to_string(libfile); let buffer = read_to_string(libfile);
if let Err(..) = buffer { if let Err(error) = buffer {
println!("Error: {}", buffer.unwrap_err()); println!("Error: {error}");
Ok(JsValue::Rational(-1.0)) Ok(JsValue::Rational(-1.0))
} else { } else {
// Load and parse the module source // Load and parse the module source

Loading…
Cancel
Save