Browse Source

Fix new lints for Rust 1.73 (#3361)

pull/3366/head
José Julián Espina 1 year ago committed by GitHub
parent
commit
a56ce510d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      boa_ast/src/lib.rs
  2. 1
      boa_cli/src/main.rs
  3. 2
      boa_engine/src/builtins/string/mod.rs
  4. 2
      boa_engine/src/bytecompiler/mod.rs
  5. 1
      boa_engine/src/lib.rs
  6. 2
      boa_engine/src/string/mod.rs
  7. 2
      boa_engine/src/symbol.rs
  8. 1
      boa_engine/src/value/conversions/mod.rs
  9. 2
      boa_engine/src/value/operations.rs
  10. 5
      boa_gc/src/lib.rs
  11. 1
      boa_icu_provider/src/lib.rs
  12. 1
      boa_interner/src/lib.rs
  13. 1
      boa_macros/src/lib.rs
  14. 43
      boa_parser/src/error/mod.rs
  15. 1
      boa_parser/src/lib.rs
  16. 2
      boa_parser/src/parser/expression/left_hand_side/optional/mod.rs
  17. 1
      boa_profiler/src/lib.rs
  18. 1
      boa_runtime/src/lib.rs
  19. 2
      boa_tester/src/exec/mod.rs
  20. 1
      boa_tester/src/main.rs
  21. 1
      boa_wasm/src/lib.rs

1
boa_ast/src/lib.rs

@ -70,7 +70,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
#![allow(
clippy::module_name_repetitions,

1
boa_cli/src/main.rs

@ -57,7 +57,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
mod debug;

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

@ -730,7 +730,7 @@ impl String {
Ok(js_string!(result).into())
}
// 5. If n is 0, return the empty String.
IntegerOrInfinity::Integer(n) if n == 0 => Ok(js_string!().into()),
IntegerOrInfinity::Integer(0) => Ok(js_string!().into()),
// 4. If n < 0 or n is +∞, throw a RangeError exception.
_ => Err(JsNativeError::range()
.with_message(

2
boa_engine/src/bytecompiler/mod.rs

@ -1098,7 +1098,6 @@ impl<'ctx, 'host> ByteCompiler<'ctx, 'host> {
for variable in decl.0.as_ref() {
match variable.binding() {
Binding::Identifier(ident) => {
let ident = ident;
if let Some(expr) = variable.init() {
self.compile_expr(expr, true);
self.emit_binding(BindingOpcode::InitVar, *ident);
@ -1126,7 +1125,6 @@ impl<'ctx, 'host> ByteCompiler<'ctx, 'host> {
for variable in decls.as_ref() {
match variable.binding() {
Binding::Identifier(ident) => {
let ident = ident;
if let Some(expr) = variable.init() {
self.compile_expr(expr, true);
} else {

1
boa_engine/src/lib.rs

@ -103,7 +103,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
#![allow(
// Currently throws a false positive regarding dependencies that are only used in benchmarks.

2
boa_engine/src/string/mod.rs

@ -843,7 +843,7 @@ impl PartialEq<JsString> for str {
impl PartialOrd for JsString {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self[..].partial_cmp(other)
Some(self.cmp(other))
}
}

2
boa_engine/src/symbol.rs

@ -340,7 +340,7 @@ impl PartialEq for JsSymbol {
impl PartialOrd for JsSymbol {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.hash().partial_cmp(&other.hash())
Some(self.cmp(other))
}
}

1
boa_engine/src/value/conversions/mod.rs

@ -165,6 +165,7 @@ impl From<JsObject> for JsValue {
impl From<()> for JsValue {
#[inline]
#[allow(clippy::pedantic)] // didn't want to increase our MSRV for just a lint.
fn from(_: ()) -> Self {
let _timer = Profiler::global().start_event("From<()>", "value");

2
boa_engine/src/value/operations.rs

@ -477,7 +477,7 @@ impl JsValue {
),
Self::String(ref str) => Self::new(-str.to_number()),
Self::Rational(num) => Self::new(-num),
Self::Integer(num) if num == 0 => Self::new(-f64::from(0)),
Self::Integer(0) => Self::new(-f64::from(0)),
Self::Integer(num) => Self::new(-num),
Self::Boolean(true) => Self::new(1),
Self::Boolean(false) | Self::Null => Self::new(0),

5
boa_gc/src/lib.rs

@ -62,7 +62,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
#![allow(
clippy::module_name_repetitions,
@ -329,7 +328,7 @@ impl Collector {
}
}
fn trace_non_roots(gc: &mut BoaGc) {
fn trace_non_roots(gc: &BoaGc) {
// Count all the handles located in GC heap.
// Then, we can find whether there is a reference from other places, and they are the roots.
let mut strong = &gc.strong_start;
@ -522,7 +521,7 @@ impl Collector {
}
// Clean up the heap when BoaGc is dropped
fn dump(gc: &mut BoaGc) {
fn dump(gc: &BoaGc) {
// Weak maps have to be dropped first, since the process dereferences GcBoxes.
// This can be done without initializing a dropguard since no GcBox's are being dropped.
let weak_map_head = &gc.weak_map_start;

1
boa_icu_provider/src/lib.rs

@ -70,7 +70,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
#![allow(elided_lifetimes_in_paths)]
#![cfg_attr(not(feature = "bin"), no_std)]

1
boa_interner/src/lib.rs

@ -67,7 +67,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
#![allow(
clippy::redundant_pub_crate,

1
boa_macros/src/lib.rs

@ -57,7 +57,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
use proc_macro::TokenStream;

43
boa_parser/src/error/mod.rs

@ -183,38 +183,31 @@ impl fmt::Display for Error {
found,
span,
context,
} => write!(
f,
"expected {}, got '{found}' in {context} at line {}, col {}",
if expected.len() == 1 {
format!(
"token '{}'",
expected.first().expect("already checked that length is 1")
)
} else {
format!(
"one of {}",
expected
.iter()
.enumerate()
.map(|(i, t)| {
format!(
"{}'{t}'",
if i == 0 {
} => {
write!(f, "expected ")?;
match &**expected {
[single] => write!(f, "token '{single}'")?,
expected => {
write!(f, "one of ")?;
for (i, token) in expected.iter().enumerate() {
let prefix = if i == 0 {
""
} else if i == expected.len() - 1 {
" or "
} else {
", "
},
)
})
.collect::<String>()
)
},
};
write!(f, "{prefix}'{token}'")?;
}
}
}
write!(
f,
", got '{found}' in {context} at line {}, col {}",
span.start().line_number(),
span.start().column_number()
),
)
}
Self::Unexpected {
found,
span,

1
boa_parser/src/lib.rs

@ -67,7 +67,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
#![allow(
clippy::module_name_repetitions,

2
boa_parser/src/parser/expression/left_hand_side/optional/mod.rs

@ -62,7 +62,7 @@ where
fn parse(self, cursor: &mut Cursor<R>, interner: &mut Interner) -> ParseResult<Self::Output> {
fn parse_const_access(
token: &Token,
interner: &mut Interner,
interner: &Interner,
) -> ParseResult<OptionalOperationKind> {
let item = match token.kind() {
TokenKind::IdentifierName((name, _)) => {

1
boa_profiler/src/lib.rs

@ -64,7 +64,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
#![cfg_attr(not(feature = "profiler"), no_std)]

1
boa_runtime/src/lib.rs

@ -96,7 +96,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
#![allow(
clippy::module_name_repetitions,

2
boa_tester/src/exec/mod.rs

@ -634,7 +634,7 @@ fn register_print_fn(context: &mut Context<'_>, async_result: AsyncResult) {
let mut result = async_result.inner.borrow_mut();
match *result {
UninitResult::Uninit | UninitResult::Ok(_) => {
UninitResult::Uninit | UninitResult::Ok(()) => {
if message == "Test262:AsyncTestComplete" {
*result = UninitResult::Ok(());
} else {

1
boa_tester/src/main.rs

@ -60,7 +60,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
#![allow(
clippy::too_many_lines,

1
boa_wasm/src/lib.rs

@ -57,7 +57,6 @@
clippy::complexity,
clippy::perf,
clippy::pedantic,
clippy::nursery,
)]
use boa_engine::{Context, Source};

Loading…
Cancel
Save