Skip to content

Commit

Permalink
Remove unused lint allows (#2968)
Browse files Browse the repository at this point in the history
  • Loading branch information
raskad committed May 27, 2023
1 parent d70b229 commit 4ea80f4
Show file tree
Hide file tree
Showing 21 changed files with 9 additions and 34 deletions.
1 change: 0 additions & 1 deletion boa_engine/src/builtins/boolean/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
1 change: 0 additions & 1 deletion boa_engine/src/builtins/map/ordered_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<H: Hasher>(&self, state: &mut H) {
match self {
Expand Down
2 changes: 0 additions & 2 deletions boa_engine/src/builtins/number/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::float_cmp)]

use crate::{
builtins::Number, run_test_actions, value::AbstractRelation, JsNativeErrorKind, TestAction,
};
Expand Down
1 change: 0 additions & 1 deletion boa_engine/src/builtins/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
1 change: 0 additions & 1 deletion boa_engine/src/builtins/string/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 0 additions & 3 deletions boa_engine/src/bytecompiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Identifier>,
Expand Down Expand Up @@ -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 => {}
Expand Down
8 changes: 2 additions & 6 deletions boa_engine/src/object/builtins/jspromise.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand All @@ -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.
///
Expand Down
1 change: 0 additions & 1 deletion boa_engine/src/object/internal_methods/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PropertyDescriptor> {
// 1. Assert: S is an Object that has a [[StringData]] internal slot.
// 2. Assert: IsPropertyKey(P) is true.
Expand Down
1 change: 0 additions & 1 deletion boa_engine/src/realm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ impl Realm {
&self.inner.global_this
}

#[allow(unused)]
pub(crate) fn loaded_modules(&self) -> &GcRefCell<FxHashMap<JsString, Module>> {
&self.inner.loaded_modules
}
Expand Down
1 change: 0 additions & 1 deletion boa_engine/src/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 0 additions & 2 deletions boa_engine/src/value/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions boa_parser/src/lexer/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F>(&mut self, pred: &F) -> io::Result<bool>
where
F: Fn(u32) -> bool,
Expand Down Expand Up @@ -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<F>(&mut self, buf: &mut Vec<u8>, pred: &F) -> io::Result<()>
where
F: Fn(u32) -> bool,
Expand Down Expand Up @@ -284,11 +284,11 @@ where

/// Inner iterator for a cursor.
#[derive(Debug)]
#[allow(clippy::option_option)]
struct InnerIter<R> {
iter: Bytes<R>,
num_peeked_bytes: u8,
peeked_bytes: [u8; 4],
#[allow(clippy::option_option)]
peeked_char: Option<Option<u32>>,
}

Expand Down
1 change: 0 additions & 1 deletion boa_parser/src/lexer/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! Tests for the lexer.
#![allow(clippy::indexing_slicing)]

use crate::lexer::{
template::TemplateString,
Expand Down
1 change: 0 additions & 1 deletion boa_parser/src/parser/cursor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion boa_parser/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ impl From<bool> 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<R>,
Expand Down
1 change: 0 additions & 1 deletion boa_parser/src/parser/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<L>(js: &str, expr: L, interner: &mut Interner)
where
Expand Down
1 change: 0 additions & 1 deletion boa_profiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 0 additions & 2 deletions boa_runtime/src/console/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions boa_tester/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion boa_tester/src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<str>,
pub(super) esid: Option<Box<str>>,
#[allow(dead_code)]
pub(super) es5id: Option<Box<str>>,
pub(super) es6id: Option<Box<str>>,
#[serde(default)]
Expand Down
2 changes: 1 addition & 1 deletion boa_tester/src/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")?,
Expand Down Expand Up @@ -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) => {}
Expand Down

0 comments on commit 4ea80f4

Please sign in to comment.