Browse Source

Remove unused lint allows (#2968)

pull/2970/head
raskad 2 years ago committed by GitHub
parent
commit
4ea80f4621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      boa_engine/src/builtins/boolean/tests.rs
  2. 1
      boa_engine/src/builtins/map/ordered_map.rs
  3. 2
      boa_engine/src/builtins/number/tests.rs
  4. 1
      boa_engine/src/builtins/string/mod.rs
  5. 1
      boa_engine/src/builtins/string/tests.rs
  6. 3
      boa_engine/src/bytecompiler/mod.rs
  7. 8
      boa_engine/src/object/builtins/jspromise.rs
  8. 1
      boa_engine/src/object/internal_methods/string.rs
  9. 1
      boa_engine/src/realm.rs
  10. 1
      boa_engine/src/string/mod.rs
  11. 2
      boa_engine/src/value/tests.rs
  12. 6
      boa_parser/src/lexer/cursor.rs
  13. 1
      boa_parser/src/lexer/tests.rs
  14. 1
      boa_parser/src/parser/cursor/mod.rs
  15. 2
      boa_parser/src/parser/mod.rs
  16. 1
      boa_parser/src/parser/tests/mod.rs
  17. 1
      boa_profiler/src/lib.rs
  18. 2
      boa_runtime/src/console/mod.rs
  19. 3
      boa_tester/src/main.rs
  20. 2
      boa_tester/src/read.rs
  21. 2
      boa_tester/src/results.rs

1
boa_engine/src/builtins/boolean/tests.rs

@ -2,7 +2,6 @@ use crate::{run_test_actions, TestAction};
use indoc::indoc; use indoc::indoc;
/// Test the correct type is returned from call and construct /// Test the correct type is returned from call and construct
#[allow(clippy::unwrap_used)]
#[test] #[test]
fn construct_and_call() { fn construct_and_call() {
run_test_actions([ run_test_actions([

1
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. // 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 { impl Hash for MapKey {
fn hash<H: Hasher>(&self, state: &mut H) { fn hash<H: Hasher>(&self, state: &mut H) {
match self { match self {

2
boa_engine/src/builtins/number/tests.rs

@ -1,5 +1,3 @@
#![allow(clippy::float_cmp)]
use crate::{ use crate::{
builtins::Number, run_test_actions, value::AbstractRelation, JsNativeErrorKind, TestAction, builtins::Number, run_test_actions, value::AbstractRelation, JsNativeErrorKind, TestAction,
}; };

1
boa_engine/src/builtins/string/mod.rs

@ -2153,7 +2153,6 @@ impl String {
rx.invoke(JsSymbol::search(), &[JsValue::new(string)], context) rx.invoke(JsSymbol::search(), &[JsValue::new(string)], context)
} }
#[allow(clippy::unnecessary_wraps)]
pub(crate) fn iterator( pub(crate) fn iterator(
this: &JsValue, this: &JsValue,
_: &[JsValue], _: &[JsValue],

1
boa_engine/src/builtins/string/tests.rs

@ -73,7 +73,6 @@ fn generic_concat() {
]); ]);
} }
#[allow(clippy::unwrap_used)]
#[test] #[test]
/// Test the correct type is returned from call and construct /// Test the correct type is returned from call and construct
fn construct_and_call() { fn construct_and_call() {

3
boa_engine/src/bytecompiler/mod.rs

@ -73,7 +73,6 @@ impl FunctionKind {
/// Describes the complete specification of a function node. /// Describes the complete specification of a function node.
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
#[allow(single_use_lifetimes)]
pub(crate) struct FunctionSpec<'a> { pub(crate) struct FunctionSpec<'a> {
pub(crate) kind: FunctionKind, pub(crate) kind: FunctionKind,
pub(crate) name: Option<Identifier>, pub(crate) name: Option<Identifier>,
@ -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) { fn access_set_top_of_stack_expr_fn(compiler: &mut ByteCompiler<'_, '_>, level: u8) {
match level { match level {
0 => {} 0 => {}

8
boa_engine/src/object/builtins/jspromise.rs

@ -1,9 +1,6 @@
//! A Rust API wrapper for Boa's promise Builtin ECMAScript Object //! A Rust API wrapper for Boa's promise Builtin ECMAScript Object
#![allow(missing_docs)] use super::{JsArray, JsFunction};
use boa_gc::{Finalize, Trace};
use crate::{ use crate::{
builtins::{ builtins::{
promise::{PromiseState, ResolvingFunctions}, promise::{PromiseState, ResolvingFunctions},
@ -14,8 +11,7 @@ use crate::{
value::TryFromJs, value::TryFromJs,
Context, JsError, JsNativeError, JsResult, JsValue, Context, JsError, JsNativeError, JsResult, JsValue,
}; };
use boa_gc::{Finalize, Trace};
use super::{JsArray, JsFunction};
/// An ECMAScript [promise] object. /// An ECMAScript [promise] object.
/// ///

1
boa_engine/src/object/internal_methods/string.rs

@ -134,7 +134,6 @@ pub(crate) fn string_exotic_own_property_keys(
/// - [ECMAScript reference][spec] /// - [ECMAScript reference][spec]
/// ///
/// [spec]: https://tc39.es/ecma262/#sec-stringgetownproperty /// [spec]: https://tc39.es/ecma262/#sec-stringgetownproperty
#[allow(clippy::float_cmp)]
fn string_get_own_property(obj: &JsObject, key: &PropertyKey) -> Option<PropertyDescriptor> { fn string_get_own_property(obj: &JsObject, key: &PropertyKey) -> Option<PropertyDescriptor> {
// 1. Assert: S is an Object that has a [[StringData]] internal slot. // 1. Assert: S is an Object that has a [[StringData]] internal slot.
// 2. Assert: IsPropertyKey(P) is true. // 2. Assert: IsPropertyKey(P) is true.

1
boa_engine/src/realm.rs

@ -100,7 +100,6 @@ impl Realm {
&self.inner.global_this &self.inner.global_this
} }
#[allow(unused)]
pub(crate) fn loaded_modules(&self) -> &GcRefCell<FxHashMap<JsString, Module>> { pub(crate) fn loaded_modules(&self) -> &GcRefCell<FxHashMap<JsString, Module>> {
&self.inner.loaded_modules &self.inner.loaded_modules
} }

1
boa_engine/src/string/mod.rs

@ -450,7 +450,6 @@ impl JsString {
/// - [ECMAScript reference][spec] /// - [ECMAScript reference][spec]
/// ///
/// [spec]: https://tc39.es/ecma262/#sec-stringtonumber /// [spec]: https://tc39.es/ecma262/#sec-stringtonumber
#[allow(clippy::question_mark)]
pub(crate) fn to_number(&self) -> f64 { pub(crate) fn to_number(&self) -> f64 {
// 1. Let text be ! StringToCodePoints(str). // 1. Let text be ! StringToCodePoints(str).
// 2. Let literal be ParseText(text, StringNumericLiteral). // 2. Let literal be ParseText(text, StringNumericLiteral).

2
boa_engine/src/value/tests.rs

@ -109,7 +109,6 @@ fn hash_undefined() {
} }
#[test] #[test]
#[allow(clippy::eq_op)]
fn hash_rational() { fn hash_rational() {
let value1 = JsValue::new(1.0); let value1 = JsValue::new(1.0);
let value2 = JsValue::new(1.0); let value2 = JsValue::new(1.0);
@ -123,7 +122,6 @@ fn hash_rational() {
} }
#[test] #[test]
#[allow(clippy::eq_op)]
fn hash_object() { fn hash_object() {
let object1 = JsValue::new(JsObject::with_null_proto()); let object1 = JsValue::new(JsObject::with_null_proto());
assert_eq!(object1, object1); assert_eq!(object1, object1);

6
boa_parser/src/lexer/cursor.rs

@ -133,7 +133,7 @@ where
/// predicate on the ascii char /// predicate on the ascii char
/// ///
/// The buffer is not incremented. /// The buffer is not incremented.
#[allow(dead_code)] #[cfg(test)]
pub(super) fn next_is_char_pred<F>(&mut self, pred: &F) -> io::Result<bool> pub(super) fn next_is_char_pred<F>(&mut self, pred: &F) -> io::Result<bool>
where where
F: Fn(u32) -> bool, F: Fn(u32) -> bool,
@ -190,7 +190,7 @@ where
/// It also stops when there is no next character. /// 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. /// 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<F>(&mut self, buf: &mut Vec<u8>, pred: &F) -> io::Result<()> pub(super) fn take_while_char_pred<F>(&mut self, buf: &mut Vec<u8>, pred: &F) -> io::Result<()>
where where
F: Fn(u32) -> bool, F: Fn(u32) -> bool,
@ -284,11 +284,11 @@ where
/// Inner iterator for a cursor. /// Inner iterator for a cursor.
#[derive(Debug)] #[derive(Debug)]
#[allow(clippy::option_option)]
struct InnerIter<R> { struct InnerIter<R> {
iter: Bytes<R>, iter: Bytes<R>,
num_peeked_bytes: u8, num_peeked_bytes: u8,
peeked_bytes: [u8; 4], peeked_bytes: [u8; 4],
#[allow(clippy::option_option)]
peeked_char: Option<Option<u32>>, peeked_char: Option<Option<u32>>,
} }

1
boa_parser/src/lexer/tests.rs

@ -1,5 +1,4 @@
//! Tests for the lexer. //! Tests for the lexer.
#![allow(clippy::indexing_slicing)]
use crate::lexer::{ use crate::lexer::{
template::TemplateString, template::TemplateString,

1
boa_parser/src/parser/cursor/mod.rs

@ -55,7 +55,6 @@ where
} }
/// Sets the goal symbol of the cursor to `Module`. /// Sets the goal symbol of the cursor to `Module`.
#[allow(unused)]
pub(super) fn set_module(&mut self) { pub(super) fn set_module(&mut self) {
self.buffered_lexer.set_module(true); self.buffered_lexer.set_module(true);
} }

2
boa_parser/src/parser/mod.rs

@ -109,9 +109,9 @@ impl From<bool> for AllowDefault {
/// [label]: https://tc39.es/ecma262/#sec-labelled-function-declarations /// [label]: https://tc39.es/ecma262/#sec-labelled-function-declarations
/// [block]: https://tc39.es/ecma262/#sec-block-duplicates-allowed-static-semantics /// [block]: https://tc39.es/ecma262/#sec-block-duplicates-allowed-static-semantics
#[derive(Debug)] #[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> { pub struct Parser<'a, R> {
/// Path to the source being parsed. /// Path to the source being parsed.
#[allow(unused)] // Good to have for future improvements.
path: Option<&'a Path>, path: Option<&'a Path>,
/// Cursor of the parser, pointing to the lexer and used to get tokens for the parser. /// Cursor of the parser, pointing to the lexer and used to get tokens for the parser.
cursor: Cursor<R>, cursor: Cursor<R>,

1
boa_parser/src/parser/tests/mod.rs

@ -30,7 +30,6 @@ use boa_interner::Interner;
use boa_macros::utf16; use boa_macros::utf16;
/// Checks that the given JavaScript string gives the expected expression. /// Checks that the given JavaScript string gives the expected expression.
#[allow(clippy::unwrap_used)]
#[track_caller] #[track_caller]
pub(super) fn check_script_parser<L>(js: &str, expr: L, interner: &mut Interner) pub(super) fn check_script_parser<L>(js: &str, expr: L, interner: &mut Interner)
where where

1
boa_profiler/src/lib.rs

@ -183,7 +183,6 @@ impl Debug for Profiler {
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct Profiler; pub struct Profiler;
//#[allow(clippy::unused_unit, clippy::unused_self)]
#[cfg(not(feature = "profiler"))] #[cfg(not(feature = "profiler"))]
impl Profiler { impl Profiler {
/// Does nothing. /// Does nothing.

2
boa_runtime/src/console/mod.rs

@ -11,8 +11,6 @@
//! [spec]: https://console.spec.whatwg.org/ //! [spec]: https://console.spec.whatwg.org/
//! [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/Console //! [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/Console
#![allow(clippy::print_stdout)]
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;

3
boa_tester/src/main.rs

@ -63,8 +63,7 @@
#![allow( #![allow(
clippy::too_many_lines, clippy::too_many_lines,
clippy::redundant_pub_crate, clippy::redundant_pub_crate,
clippy::cast_precision_loss, clippy::cast_precision_loss
clippy::cast_possible_wrap
)] )]
mod edition; mod edition;

2
boa_tester/src/read.rs

@ -16,10 +16,10 @@ use std::{
/// Representation of the YAML metadata in Test262 tests. /// Representation of the YAML metadata in Test262 tests.
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Deserialize)]
#[allow(dead_code)]
pub(super) struct MetaData { pub(super) struct MetaData {
pub(super) description: Box<str>, pub(super) description: Box<str>,
pub(super) esid: Option<Box<str>>, pub(super) esid: Option<Box<str>>,
#[allow(dead_code)]
pub(super) es5id: Option<Box<str>>, pub(super) es5id: Option<Box<str>>,
pub(super) es6id: Option<Box<str>>, pub(super) es6id: Option<Box<str>>,
#[serde(default)] #[serde(default)]

2
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. /// 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<()> { pub(crate) fn compare_results(base: &Path, new: &Path, markdown: bool) -> Result<()> {
let base_results: ResultInfo = serde_json::from_reader(BufReader::new( let base_results: ResultInfo = serde_json::from_reader(BufReader::new(
fs::File::open(base).wrap_err("could not open the base results file")?, fs::File::open(base).wrap_err("could not open the base results file")?,
@ -470,7 +471,6 @@ fn compute_result_diff(
) )
.into_boxed_str(); .into_boxed_str();
#[allow(clippy::match_same_arms)]
match (base_test.result, new_test.result) { match (base_test.result, new_test.result) {
(a, b) if a == b => {} (a, b) if a == b => {}
(TestOutcomeResult::Ignored, TestOutcomeResult::Failed) => {} (TestOutcomeResult::Ignored, TestOutcomeResult::Failed) => {}

Loading…
Cancel
Save