From 93d05bda6864aa6ee67682d84bd4fc2108093ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Borges?= <rageknify@gmail.com> Date: Thu, 13 Jul 2023 20:12:17 +0100 Subject: [PATCH] Fix 1.71.0 lints (#3140) * Fix 1.71.0 lints * Attest suggestion --- boa_engine/src/context/mod.rs | 2 +- boa_engine/src/module/mod.rs | 2 +- boa_engine/src/object/builtins/jsdataview.rs | 5 +---- boa_examples/src/bin/modulehandler.rs | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/boa_engine/src/context/mod.rs b/boa_engine/src/context/mod.rs index 5c4ea4fc760..56641c8300f 100644 --- a/boa_engine/src/context/mod.rs +++ b/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`] /// 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> { let main_timer = Profiler::global().start_event("Script evaluation", "Main"); diff --git a/boa_engine/src/module/mod.rs b/boa_engine/src/module/mod.rs index abd610d04ea..cb5f8693a19 100644 --- a/boa_engine/src/module/mod.rs +++ b/boa_engine/src/module/mod.rs @@ -641,7 +641,7 @@ impl Module { /// /// assert_eq!(promise.state().unwrap(), PromiseState::Fulfilled(JsValue::undefined())); /// ``` - #[allow(clippy::drop_copy)] + #[allow(dropping_copy_types)] #[inline] pub fn load_link_evaluate(&self, context: &mut Context<'_>) -> JsResult<JsPromise> { let main_timer = Profiler::global().start_event("Module evaluation", "Main"); diff --git a/boa_engine/src/object/builtins/jsdataview.rs b/boa_engine/src/object/builtins/jsdataview.rs index 960e0073586..fc12a59f097 100644 --- a/boa_engine/src/object/builtins/jsdataview.rs +++ b/boa_engine/src/object/builtins/jsdataview.rs @@ -68,10 +68,7 @@ impl JsDataView { .into()); } - let view_byte_length = if let Some(..) = byte_length { - // Get the provided length - let provided_length = byte_length.expect("byte_length must be a u64"); - + let view_byte_length = if let Some(provided_length) = byte_length { // Check that the provided length and offset does not exceed the bounds of the ArrayBuffer if provided_offset + provided_length > array_buffer_length { return Err(JsNativeError::range() diff --git a/boa_examples/src/bin/modulehandler.rs b/boa_examples/src/bin/modulehandler.rs index d96a1efb9e3..fdb324d1bb5 100644 --- a/boa_examples/src/bin/modulehandler.rs +++ b/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 println!("Loading: {libfile}"); let buffer = read_to_string(libfile); - if let Err(..) = buffer { - println!("Error: {}", buffer.unwrap_err()); + if let Err(error) = buffer { + println!("Error: {error}"); Ok(JsValue::Rational(-1.0)) } else { // Load and parse the module source