From f864b8eacd7b3e7aa29ffd78d96dd1f20f12e19f Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Sat, 27 May 2023 16:45:24 +0200 Subject: [PATCH] Remove unused lint allows --- boa_engine/src/builtins/boolean/tests.rs | 1 - boa_engine/src/builtins/map/ordered_map.rs | 1 - boa_engine/src/builtins/number/tests.rs | 2 -- boa_engine/src/builtins/string/mod.rs | 1 - boa_engine/src/builtins/string/tests.rs | 1 - boa_engine/src/bytecompiler/mod.rs | 3 --- boa_engine/src/object/builtins/jspromise.rs | 8 ++------ boa_engine/src/object/internal_methods/string.rs | 1 - boa_engine/src/realm.rs | 1 - boa_engine/src/string/mod.rs | 1 - boa_engine/src/value/tests.rs | 2 -- boa_parser/src/lexer/cursor.rs | 6 +++--- boa_parser/src/lexer/tests.rs | 1 - boa_parser/src/parser/cursor/mod.rs | 1 - boa_parser/src/parser/mod.rs | 2 +- boa_parser/src/parser/tests/mod.rs | 1 - boa_profiler/src/lib.rs | 1 - boa_runtime/src/console/mod.rs | 2 -- boa_tester/src/main.rs | 3 +-- boa_tester/src/read.rs | 2 +- boa_tester/src/results.rs | 2 +- 21 files changed, 9 insertions(+), 34 deletions(-) diff --git a/boa_engine/src/builtins/boolean/tests.rs b/boa_engine/src/builtins/boolean/tests.rs index 39e428e875f..90ac2735042 100644 --- a/boa_engine/src/builtins/boolean/tests.rs +++ b/boa_engine/src/builtins/boolean/tests.rs @@ -2,7 +2,6 @@ use crate::{run_test_actions, TestAction}; use indoc::indoc; /// Test the correct type is returned from call and construct -#[allow(clippy::unwrap_used)] #[test] fn construct_and_call() { run_test_actions([ diff --git a/boa_engine/src/builtins/map/ordered_map.rs b/boa_engine/src/builtins/map/ordered_map.rs index 626e12ddfa9..9ee5e7036bf 100644 --- a/boa_engine/src/builtins/map/ordered_map.rs +++ b/boa_engine/src/builtins/map/ordered_map.rs @@ -16,7 +16,6 @@ pub(crate) enum MapKey { } // This ensures that a MapKey::Key(value) hashes to the same as value. The derived PartialEq implementation still holds. -#[allow(clippy::derived_hash_with_manual_eq)] impl Hash for MapKey { fn hash(&self, state: &mut H) { match self { diff --git a/boa_engine/src/builtins/number/tests.rs b/boa_engine/src/builtins/number/tests.rs index 8e38fe3e78a..c5ca4858472 100644 --- a/boa_engine/src/builtins/number/tests.rs +++ b/boa_engine/src/builtins/number/tests.rs @@ -1,5 +1,3 @@ -#![allow(clippy::float_cmp)] - use crate::{ builtins::Number, run_test_actions, value::AbstractRelation, JsNativeErrorKind, TestAction, }; diff --git a/boa_engine/src/builtins/string/mod.rs b/boa_engine/src/builtins/string/mod.rs index 3b88d2131e1..efeeda192af 100644 --- a/boa_engine/src/builtins/string/mod.rs +++ b/boa_engine/src/builtins/string/mod.rs @@ -2153,7 +2153,6 @@ impl String { rx.invoke(JsSymbol::search(), &[JsValue::new(string)], context) } - #[allow(clippy::unnecessary_wraps)] pub(crate) fn iterator( this: &JsValue, _: &[JsValue], diff --git a/boa_engine/src/builtins/string/tests.rs b/boa_engine/src/builtins/string/tests.rs index a8131d3d7a8..7983eec6c55 100644 --- a/boa_engine/src/builtins/string/tests.rs +++ b/boa_engine/src/builtins/string/tests.rs @@ -73,7 +73,6 @@ fn generic_concat() { ]); } -#[allow(clippy::unwrap_used)] #[test] /// Test the correct type is returned from call and construct fn construct_and_call() { diff --git a/boa_engine/src/bytecompiler/mod.rs b/boa_engine/src/bytecompiler/mod.rs index d046d060bab..70341867ce3 100644 --- a/boa_engine/src/bytecompiler/mod.rs +++ b/boa_engine/src/bytecompiler/mod.rs @@ -73,7 +73,6 @@ impl FunctionKind { /// Describes the complete specification of a function node. #[derive(Debug, Clone, Copy, PartialEq)] -#[allow(single_use_lifetimes)] pub(crate) struct FunctionSpec<'a> { pub(crate) kind: FunctionKind, pub(crate) name: Option, @@ -606,8 +605,6 @@ impl<'ctx, 'host> ByteCompiler<'ctx, 'host> { } } - // The wrap is needed so it can match the function signature. - #[allow(clippy::unnecessary_wraps)] fn access_set_top_of_stack_expr_fn(compiler: &mut ByteCompiler<'_, '_>, level: u8) { match level { 0 => {} diff --git a/boa_engine/src/object/builtins/jspromise.rs b/boa_engine/src/object/builtins/jspromise.rs index b4efdddf4f7..85f292db9ea 100644 --- a/boa_engine/src/object/builtins/jspromise.rs +++ b/boa_engine/src/object/builtins/jspromise.rs @@ -1,9 +1,6 @@ //! A Rust API wrapper for Boa's promise Builtin ECMAScript Object -#![allow(missing_docs)] - -use boa_gc::{Finalize, Trace}; - +use super::{JsArray, JsFunction}; use crate::{ builtins::{ promise::{PromiseState, ResolvingFunctions}, @@ -14,8 +11,7 @@ use crate::{ value::TryFromJs, Context, JsError, JsNativeError, JsResult, JsValue, }; - -use super::{JsArray, JsFunction}; +use boa_gc::{Finalize, Trace}; /// An ECMAScript [promise] object. /// diff --git a/boa_engine/src/object/internal_methods/string.rs b/boa_engine/src/object/internal_methods/string.rs index 0c919b5fab5..1a99da753bc 100644 --- a/boa_engine/src/object/internal_methods/string.rs +++ b/boa_engine/src/object/internal_methods/string.rs @@ -134,7 +134,6 @@ pub(crate) fn string_exotic_own_property_keys( /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-stringgetownproperty -#[allow(clippy::float_cmp)] fn string_get_own_property(obj: &JsObject, key: &PropertyKey) -> Option { // 1. Assert: S is an Object that has a [[StringData]] internal slot. // 2. Assert: IsPropertyKey(P) is true. diff --git a/boa_engine/src/realm.rs b/boa_engine/src/realm.rs index 51529b90935..db396df201f 100644 --- a/boa_engine/src/realm.rs +++ b/boa_engine/src/realm.rs @@ -100,7 +100,6 @@ impl Realm { &self.inner.global_this } - #[allow(unused)] pub(crate) fn loaded_modules(&self) -> &GcRefCell> { &self.inner.loaded_modules } diff --git a/boa_engine/src/string/mod.rs b/boa_engine/src/string/mod.rs index 0efd535552d..90c5aa79b29 100644 --- a/boa_engine/src/string/mod.rs +++ b/boa_engine/src/string/mod.rs @@ -450,7 +450,6 @@ impl JsString { /// - [ECMAScript reference][spec] /// /// [spec]: https://tc39.es/ecma262/#sec-stringtonumber - #[allow(clippy::question_mark)] pub(crate) fn to_number(&self) -> f64 { // 1. Let text be ! StringToCodePoints(str). // 2. Let literal be ParseText(text, StringNumericLiteral). diff --git a/boa_engine/src/value/tests.rs b/boa_engine/src/value/tests.rs index d0d558e4a08..597dc5b4ab5 100644 --- a/boa_engine/src/value/tests.rs +++ b/boa_engine/src/value/tests.rs @@ -109,7 +109,6 @@ fn hash_undefined() { } #[test] -#[allow(clippy::eq_op)] fn hash_rational() { let value1 = JsValue::new(1.0); let value2 = JsValue::new(1.0); @@ -123,7 +122,6 @@ fn hash_rational() { } #[test] -#[allow(clippy::eq_op)] fn hash_object() { let object1 = JsValue::new(JsObject::with_null_proto()); assert_eq!(object1, object1); diff --git a/boa_parser/src/lexer/cursor.rs b/boa_parser/src/lexer/cursor.rs index 4c510c3a039..52185a0d19f 100644 --- a/boa_parser/src/lexer/cursor.rs +++ b/boa_parser/src/lexer/cursor.rs @@ -133,7 +133,7 @@ where /// predicate on the ascii char /// /// The buffer is not incremented. - #[allow(dead_code)] + #[cfg(test)] pub(super) fn next_is_char_pred(&mut self, pred: &F) -> io::Result where F: Fn(u32) -> bool, @@ -190,7 +190,7 @@ where /// It also stops when there is no next character. /// /// Note that all characters up until the stop character are added to the buffer, including the character right before. - #[allow(dead_code)] + #[cfg(test)] pub(super) fn take_while_char_pred(&mut self, buf: &mut Vec, pred: &F) -> io::Result<()> where F: Fn(u32) -> bool, @@ -284,11 +284,11 @@ where /// Inner iterator for a cursor. #[derive(Debug)] -#[allow(clippy::option_option)] struct InnerIter { iter: Bytes, num_peeked_bytes: u8, peeked_bytes: [u8; 4], + #[allow(clippy::option_option)] peeked_char: Option>, } diff --git a/boa_parser/src/lexer/tests.rs b/boa_parser/src/lexer/tests.rs index 8f8551f3cd5..1b489c0a53c 100644 --- a/boa_parser/src/lexer/tests.rs +++ b/boa_parser/src/lexer/tests.rs @@ -1,5 +1,4 @@ //! Tests for the lexer. -#![allow(clippy::indexing_slicing)] use crate::lexer::{ template::TemplateString, diff --git a/boa_parser/src/parser/cursor/mod.rs b/boa_parser/src/parser/cursor/mod.rs index 0c301442769..69a41cee0fe 100644 --- a/boa_parser/src/parser/cursor/mod.rs +++ b/boa_parser/src/parser/cursor/mod.rs @@ -55,7 +55,6 @@ where } /// Sets the goal symbol of the cursor to `Module`. - #[allow(unused)] pub(super) fn set_module(&mut self) { self.buffered_lexer.set_module(true); } diff --git a/boa_parser/src/parser/mod.rs b/boa_parser/src/parser/mod.rs index 3bf65abdb35..0f3e60b589d 100644 --- a/boa_parser/src/parser/mod.rs +++ b/boa_parser/src/parser/mod.rs @@ -109,9 +109,9 @@ impl From for AllowDefault { /// [label]: https://tc39.es/ecma262/#sec-labelled-function-declarations /// [block]: https://tc39.es/ecma262/#sec-block-duplicates-allowed-static-semantics #[derive(Debug)] -#[allow(unused)] // Right now the path is not used, but it's better to have it for future improvements. pub struct Parser<'a, R> { /// Path to the source being parsed. + #[allow(unused)] // Good to have for future improvements. path: Option<&'a Path>, /// Cursor of the parser, pointing to the lexer and used to get tokens for the parser. cursor: Cursor, diff --git a/boa_parser/src/parser/tests/mod.rs b/boa_parser/src/parser/tests/mod.rs index f1c8a70d5b9..3d8cb3cf1b6 100644 --- a/boa_parser/src/parser/tests/mod.rs +++ b/boa_parser/src/parser/tests/mod.rs @@ -30,7 +30,6 @@ use boa_interner::Interner; use boa_macros::utf16; /// Checks that the given JavaScript string gives the expected expression. -#[allow(clippy::unwrap_used)] #[track_caller] pub(super) fn check_script_parser(js: &str, expr: L, interner: &mut Interner) where diff --git a/boa_profiler/src/lib.rs b/boa_profiler/src/lib.rs index 878f45aaaef..fdbd6a25bcc 100644 --- a/boa_profiler/src/lib.rs +++ b/boa_profiler/src/lib.rs @@ -183,7 +183,6 @@ impl Debug for Profiler { #[derive(Copy, Clone)] pub struct Profiler; -//#[allow(clippy::unused_unit, clippy::unused_self)] #[cfg(not(feature = "profiler"))] impl Profiler { /// Does nothing. diff --git a/boa_runtime/src/console/mod.rs b/boa_runtime/src/console/mod.rs index a699506e1a3..dac9a2e8db2 100644 --- a/boa_runtime/src/console/mod.rs +++ b/boa_runtime/src/console/mod.rs @@ -11,8 +11,6 @@ //! [spec]: https://console.spec.whatwg.org/ //! [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/Console -#![allow(clippy::print_stdout)] - #[cfg(test)] mod tests; diff --git a/boa_tester/src/main.rs b/boa_tester/src/main.rs index b95fe1e3bb8..6cc192a3ed0 100644 --- a/boa_tester/src/main.rs +++ b/boa_tester/src/main.rs @@ -63,8 +63,7 @@ #![allow( clippy::too_many_lines, clippy::redundant_pub_crate, - clippy::cast_precision_loss, - clippy::cast_possible_wrap + clippy::cast_precision_loss )] mod edition; diff --git a/boa_tester/src/read.rs b/boa_tester/src/read.rs index 2dc76452329..8bbb819d68c 100644 --- a/boa_tester/src/read.rs +++ b/boa_tester/src/read.rs @@ -16,10 +16,10 @@ use std::{ /// Representation of the YAML metadata in Test262 tests. #[derive(Debug, Clone, Deserialize)] -#[allow(dead_code)] pub(super) struct MetaData { pub(super) description: Box, pub(super) esid: Option>, + #[allow(dead_code)] pub(super) es5id: Option>, pub(super) es6id: Option>, #[serde(default)] diff --git a/boa_tester/src/results.rs b/boa_tester/src/results.rs index 94f3bbc6595..1b78a791c28 100644 --- a/boa_tester/src/results.rs +++ b/boa_tester/src/results.rs @@ -193,6 +193,7 @@ fn update_gh_pages_repo(path: &Path, verbose: u8) { } /// Compares the results of two test suite runs. +#[allow(clippy::cast_possible_wrap)] pub(crate) fn compare_results(base: &Path, new: &Path, markdown: bool) -> Result<()> { let base_results: ResultInfo = serde_json::from_reader(BufReader::new( fs::File::open(base).wrap_err("could not open the base results file")?, @@ -470,7 +471,6 @@ fn compute_result_diff( ) .into_boxed_str(); - #[allow(clippy::match_same_arms)] match (base_test.result, new_test.result) { (a, b) if a == b => {} (TestOutcomeResult::Ignored, TestOutcomeResult::Failed) => {}