From f762b11695f9ea36e18d8a7dd9c1097878c870de Mon Sep 17 00:00:00 2001 From: Hans Larsen Date: Tue, 17 Dec 2024 11:15:14 -0800 Subject: [PATCH] Fix lints --- core/engine/src/builtins/string/mod.rs | 36 +++++++++---------- .../src/builtins/typed_array/builtin.rs | 8 ++--- core/engine/src/value/mod.rs | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/core/engine/src/builtins/string/mod.rs b/core/engine/src/builtins/string/mod.rs index 52709169319..45464d9bde1 100644 --- a/core/engine/src/builtins/string/mod.rs +++ b/core/engine/src/builtins/string/mod.rs @@ -283,7 +283,7 @@ impl String { .configurable(false), context, ) - .expect("length definition for a new string must not fail"); + .expect("length definition for a new string must not fail"); // 9. Return S. s @@ -714,21 +714,21 @@ impl String { // 3. Let n be ? ToIntegerOrInfinity(count). match args.get_or_undefined(0).to_integer_or_infinity(context)? { IntegerOrInfinity::Integer(n) - if n > 0 && (n as usize) * len <= Self::MAX_STRING_LENGTH => - { - if string.is_empty() { - return Ok(js_string!().into()); - } - let n = n as usize; - let mut result = Vec::with_capacity(n); + if n > 0 && (n as usize) * len <= Self::MAX_STRING_LENGTH => + { + if string.is_empty() { + return Ok(js_string!().into()); + } + let n = n as usize; + let mut result = Vec::with_capacity(n); - std::iter::repeat(string.as_str()) - .take(n) - .for_each(|s| result.push(s)); + std::iter::repeat(string.as_str()) + .take(n) + .for_each(|s| result.push(s)); - // 6. Return the String value that is made from n copies of S appended together. - Ok(JsString::concat_array(&result).into()) - } + // 6. Return the String value that is made from n copies of S appended together. + Ok(JsString::concat_array(&result).into()) + } // 5. If n is 0, return the empty String. IntegerOrInfinity::Integer(0) => Ok(js_string!().into()), // 4. If n < 0 or n is +∞, throw a RangeError exception. @@ -1099,7 +1099,7 @@ impl String { &replacement, &JsString::from(string.get_expect(position + search_length..)) ) - .into()) + .into()) } /// `22.1.3.18 String.prototype.replaceAll ( searchValue, replaceValue )` @@ -1236,7 +1236,7 @@ impl String { replace_str, context, ) - .expect("GetSubstitution should never fail here."), + .expect("GetSubstitution should never fail here."), }; // d. Set result to the string-concatenation of result, preserved, and replacement. @@ -1795,7 +1795,7 @@ impl String { [requested_locale], context.intl_provider(), ) - .unwrap_or(Locale::UND); + .unwrap_or(Locale::UND); let casemapper = context.intl_provider().case_mapper()?; @@ -2015,7 +2015,7 @@ impl String { substrings.into_iter().map(JsValue::from), context, ) - .into()); + .into()); } // d. Set i to j + separatorLength. i = index + separator_length; diff --git a/core/engine/src/builtins/typed_array/builtin.rs b/core/engine/src/builtins/typed_array/builtin.rs index 632a799af88..9a82efad15f 100644 --- a/core/engine/src/builtins/typed_array/builtin.rs +++ b/core/engine/src/builtins/typed_array/builtin.rs @@ -2392,8 +2392,8 @@ impl BuiltinTypedArray { &[buffer.into(), begin_byte_offset.into()], context, )? - .upcast() - .into()) + .upcast() + .into()) } else { // 16. Else, // a. If end is undefined, let relativeEnd be srcLength; else let relativeEnd be ? ToIntegerOrInfinity(end). @@ -2412,8 +2412,8 @@ impl BuiltinTypedArray { &[buffer.into(), begin_byte_offset.into(), new_len.into()], context, )? - .upcast() - .into()) + .upcast() + .into()) } } diff --git a/core/engine/src/value/mod.rs b/core/engine/src/value/mod.rs index 0c3efcfae1d..14d1a890963 100644 --- a/core/engine/src/value/mod.rs +++ b/core/engine/src/value/mod.rs @@ -476,7 +476,7 @@ impl JsValue { PreferredType::String => js_string!("string"), PreferredType::Number => js_string!("number"), } - .into(); + .into(); // iv. Let result be ? Call(exoticToPrim, input, « hint »). let result = exotic_to_prim.call(self, &[hint], context)?;