From 4523eaf0ddc002335df2618931cc566236aea876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Juli=C3=A1n=20Espina?= Date: Fri, 9 Feb 2024 12:47:54 +0000 Subject: [PATCH] Fix clippy warnings for rustc 1.76 (#3668) --- core/ast/src/expression/call.rs | 2 +- core/ast/src/expression/operator/assign/mod.rs | 2 ++ core/engine/src/builtins/array/mod.rs | 6 +++--- core/engine/src/builtins/boolean/mod.rs | 2 +- core/engine/src/builtins/error/mod.rs | 2 +- core/engine/src/builtins/function/mod.rs | 8 ++++---- core/engine/src/builtins/math/mod.rs | 2 +- core/engine/src/builtins/regexp/mod.rs | 2 +- core/engine/src/builtins/set/ordered_set.rs | 2 +- core/engine/src/builtins/string/mod.rs | 16 ++++++++-------- core/engine/src/builtins/weak_set/mod.rs | 6 +++--- core/gc/src/pointers/ephemeron.rs | 2 ++ 12 files changed, 28 insertions(+), 24 deletions(-) diff --git a/core/ast/src/expression/call.rs b/core/ast/src/expression/call.rs index 083b182031..a3f41810eb 100644 --- a/core/ast/src/expression/call.rs +++ b/core/ast/src/expression/call.rs @@ -163,7 +163,7 @@ impl VisitWith for SuperCall { } } -/// The import() syntax, commonly called dynamic import, is a function-like expression that allows +/// The `import()` syntax, commonly called dynamic import, is a function-like expression that allows /// loading an ECMAScript module asynchronously and dynamically into a potentially non-module /// environment. /// diff --git a/core/ast/src/expression/operator/assign/mod.rs b/core/ast/src/expression/operator/assign/mod.rs index 127e9e7cf7..bb3ced2fad 100644 --- a/core/ast/src/expression/operator/assign/mod.rs +++ b/core/ast/src/expression/operator/assign/mod.rs @@ -1,3 +1,5 @@ +#![allow(clippy::doc_link_with_quotes)] + //! Assignment expression nodes, as defined by the [spec]. //! //! An [assignment operator][mdn] assigns a value to its left operand based on the value of its right diff --git a/core/engine/src/builtins/array/mod.rs b/core/engine/src/builtins/array/mod.rs index 6f0d10d78e..1de8a2179a 100644 --- a/core/engine/src/builtins/array/mod.rs +++ b/core/engine/src/builtins/array/mod.rs @@ -511,7 +511,7 @@ impl Array { /// `Array.from(arrayLike)` /// - /// The Array.from() static method creates a new, + /// The `Array.from()` static method creates a new, /// shallow-copied Array instance from an array-like or iterable object. /// /// More information: @@ -723,7 +723,7 @@ impl Array { ///'Array.prototype.at(index)' /// - /// The at() method takes an integer value and returns the item at that + /// The `at()` method takes an integer value and returns the item at that /// index, allowing for positive and negative integers. Negative integers /// count back from the last item in the array. /// @@ -2981,7 +2981,7 @@ impl Array { /// `Array.prototype.copyWithin ( target, start [ , end ] )` /// - /// The copyWithin() method shallow copies part of an array to another location + /// The `copyWithin()` method shallow copies part of an array to another location /// in the same array and returns it without modifying its length. /// /// More information: diff --git a/core/engine/src/builtins/boolean/mod.rs b/core/engine/src/builtins/boolean/mod.rs index a393923cc8..3ae156b44b 100644 --- a/core/engine/src/builtins/boolean/mod.rs +++ b/core/engine/src/builtins/boolean/mod.rs @@ -113,7 +113,7 @@ impl Boolean { Ok(JsValue::new(js_string!(boolean.to_string()))) } - /// The valueOf() method returns the primitive value of a `Boolean` object. + /// The `valueOf()` method returns the primitive value of a `Boolean` object. /// /// More information: /// - [ECMAScript reference][spec] diff --git a/core/engine/src/builtins/error/mod.rs b/core/engine/src/builtins/error/mod.rs index 398dafdf97..ebc57adee1 100644 --- a/core/engine/src/builtins/error/mod.rs +++ b/core/engine/src/builtins/error/mod.rs @@ -225,7 +225,7 @@ impl Error { /// `Error.prototype.toString()` /// - /// The toString() method returns a string representing the specified Error object. + /// The `toString()` method returns a string representing the specified Error object. /// /// More information: /// - [MDN documentation][mdn] diff --git a/core/engine/src/builtins/function/mod.rs b/core/engine/src/builtins/function/mod.rs index 45b3358c1a..771ff4f09a 100644 --- a/core/engine/src/builtins/function/mod.rs +++ b/core/engine/src/builtins/function/mod.rs @@ -353,7 +353,7 @@ impl BuiltInConstructor for BuiltInFunctionObject { /// `Function ( p1, p2, … , pn, body )` /// - /// The apply() method invokes self with the first argument as the `this` value + /// The `apply()` method invokes self with the first argument as the `this` value /// and the rest of the arguments provided as an array (or an array-like object). /// /// More information: @@ -609,7 +609,7 @@ impl BuiltInFunctionObject { /// `Function.prototype.apply ( thisArg, argArray )` /// - /// The apply() method invokes self with the first argument as the `this` value + /// The `apply()` method invokes self with the first argument as the `this` value /// and the rest of the arguments provided as an array (or an array-like object). /// /// More information: @@ -648,7 +648,7 @@ impl BuiltInFunctionObject { /// `Function.prototype.bind ( thisArg, ...args )` /// - /// The bind() method creates a new function that, when called, has its + /// The `bind()` method creates a new function that, when called, has its /// this keyword set to the provided value, with a given sequence of arguments /// preceding any provided when the new function is called. /// @@ -732,7 +732,7 @@ impl BuiltInFunctionObject { /// `Function.prototype.call ( thisArg, ...args )` /// - /// The call() method calls a function with a given this value and arguments provided individually. + /// The `call()` method calls a function with a given this value and arguments provided individually. /// /// More information: /// - [MDN documentation][mdn] diff --git a/core/engine/src/builtins/math/mod.rs b/core/engine/src/builtins/math/mod.rs index 5bd7805bd8..13d5748c07 100644 --- a/core/engine/src/builtins/math/mod.rs +++ b/core/engine/src/builtins/math/mod.rs @@ -407,7 +407,7 @@ impl Math { .into()) } - /// The Math.expm1() function returns e^x - 1, where x is the argument, and e the base of + /// The `Math.expm1()` function returns e^x - 1, where x is the argument, and e the base of /// the natural logarithms. The result is computed in a way that is accurate even when the /// value of x is close 0 /// diff --git a/core/engine/src/builtins/regexp/mod.rs b/core/engine/src/builtins/regexp/mod.rs index 0796b1a4f2..f45d2361f2 100644 --- a/core/engine/src/builtins/regexp/mod.rs +++ b/core/engine/src/builtins/regexp/mod.rs @@ -780,7 +780,7 @@ impl RegExp { /// `RegExp.prototype.exec( string )` /// - /// The exec() method executes a search for a match in a specified string. + /// The `exec()` method executes a search for a match in a specified string. /// /// Returns a result array, or `null`. /// diff --git a/core/engine/src/builtins/set/ordered_set.rs b/core/engine/src/builtins/set/ordered_set.rs index 35bac8b0cf..3ea66103f2 100644 --- a/core/engine/src/builtins/set/ordered_set.rs +++ b/core/engine/src/builtins/set/ordered_set.rs @@ -128,7 +128,7 @@ impl OrderedSet { } /// Get a key-value pair by index - /// Valid indices are 0 <= index < self.len() + /// Valid indices are 0 <= `index` < `self.len()` /// Computes in O(1) time. #[must_use] pub fn get_index(&self, index: usize) -> Option<&JsValue> { diff --git a/core/engine/src/builtins/string/mod.rs b/core/engine/src/builtins/string/mod.rs index 07a6cf7e52..f71fdfc60c 100644 --- a/core/engine/src/builtins/string/mod.rs +++ b/core/engine/src/builtins/string/mod.rs @@ -520,7 +520,7 @@ impl String { /// `String.prototype.at ( index )` /// - /// This String object's at() method returns a String consisting of the single UTF-16 code unit located at the specified position. + /// This String object's `at()` method returns a String consisting of the single UTF-16 code unit located at the specified position. /// Returns undefined if the given index cannot be found. /// /// More information: @@ -1086,7 +1086,7 @@ impl String { /// `22.1.3.18 String.prototype.replaceAll ( searchValue, replaceValue )` /// - /// The replaceAll() method returns a new string with all matches of a pattern replaced by a + /// The `replaceAll()` method returns a new string with all matches of a pattern replaced by a /// replacement. /// /// The pattern can be a string or a `RegExp`, and the replacement can be a string or a @@ -1610,7 +1610,7 @@ impl String { Self::string_pad(this, max_length, fill_string, Placement::Start, context) } - /// String.prototype.trim() + /// `String.prototype.trim()` /// /// The `trim()` method removes whitespace from both ends of a string. /// @@ -1654,7 +1654,7 @@ impl String { Ok(js_string!(string.trim_start()).into()) } - /// String.prototype.trimEnd() + /// `String.prototype.trimEnd()` /// /// The `trimEnd()` method removes whitespace from the end of a string. /// @@ -1881,7 +1881,7 @@ impl String { /// `String.prototype.split ( separator, limit )` /// - /// The split() method divides a String into an ordered list of substrings, puts these substrings into an array, and returns the array. + /// The `split()` method divides a String into an ordered list of substrings, puts these substrings into an array, and returns the array. /// The division is done by searching for a pattern; where the pattern is provided as the first parameter in the method's call. /// /// More information: @@ -1999,7 +1999,7 @@ impl String { ) } - /// String.prototype.valueOf() + /// `String.prototype.valueOf()` /// /// The `valueOf()` method returns the primitive value of a `String` object. /// @@ -2079,7 +2079,7 @@ impl String { /// `String.prototype.normalize( [ form ] )` /// - /// The normalize() method normalizes a string into a form specified in the Unicode® Standard Annex #15 + /// The `normalize()` method normalizes a string into a form specified in the Unicode® Standard Annex #15 /// /// More information: /// - [ECMAScript reference][spec] @@ -2160,7 +2160,7 @@ impl String { /// `String.prototype.search( regexp )` /// - /// The search() method executes a search for a match between a regular expression and this String object. + /// The `search()` method executes a search for a match between a regular expression and this String object. /// /// More information: /// - [ECMAScript reference][spec] diff --git a/core/engine/src/builtins/weak_set/mod.rs b/core/engine/src/builtins/weak_set/mod.rs index 3bcf87d202..61df3ba0d5 100644 --- a/core/engine/src/builtins/weak_set/mod.rs +++ b/core/engine/src/builtins/weak_set/mod.rs @@ -127,7 +127,7 @@ impl BuiltInConstructor for WeakSet { impl WeakSet { /// `WeakSet.prototype.add( value )` /// - /// The add() method appends a new object to the end of a `WeakSet` object. + /// The `add()` method appends a new object to the end of a `WeakSet` object. /// /// More information: /// - [ECMAScript reference][spec] @@ -176,7 +176,7 @@ impl WeakSet { /// `WeakSet.prototype.delete( value )` /// - /// The delete() method removes the specified element from a `WeakSet` object. + /// The `delete()` method removes the specified element from a `WeakSet` object. /// /// More information: /// - [ECMAScript reference][spec] @@ -215,7 +215,7 @@ impl WeakSet { /// `WeakSet.prototype.has( value )` /// - /// The has() method returns a boolean indicating whether an object exists in a `WeakSet` or not. + /// The `has()` method returns a boolean indicating whether an object exists in a `WeakSet` or not. /// /// More information: /// - [ECMAScript reference][spec] diff --git a/core/gc/src/pointers/ephemeron.rs b/core/gc/src/pointers/ephemeron.rs index f00969ef2a..ec038119b3 100644 --- a/core/gc/src/pointers/ephemeron.rs +++ b/core/gc/src/pointers/ephemeron.rs @@ -1,3 +1,5 @@ +#![allow(clippy::doc_link_with_quotes)] + use crate::{ finalizer_safe, internals::EphemeronBox,