Browse Source

Migrate to workspace lints (#3334)

* Migrate to workspace lints

* Fix last warnings
pull/3470/head
José Julián Espina 1 year ago committed by GitHub
parent
commit
421ff7065f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      .github/workflows/rust.yml
  2. 57
      Cargo.toml
  3. 3
      boa_ast/Cargo.toml
  4. 6
      boa_ast/src/position.rs
  5. 3
      boa_cli/Cargo.toml
  6. 57
      boa_cli/src/main.rs
  7. 3
      boa_engine/Cargo.toml
  8. 4
      boa_engine/benches/full.rs
  9. 2
      boa_engine/src/builtins/function/mod.rs
  10. 4
      boa_engine/src/builtins/intl/locale/utils.rs
  11. 97
      boa_engine/src/builtins/options.rs
  12. 2
      boa_engine/src/builtins/temporal/duration/record.rs
  13. 1
      boa_engine/src/builtins/typed_array/element/mod.rs
  14. 54
      boa_engine/src/lib.rs
  15. 2
      boa_engine/src/symbol.rs
  16. 38
      boa_examples/Cargo.toml
  17. 2
      boa_examples/src/bin/classes.rs
  18. 2
      boa_examples/src/bin/closures.rs
  19. 4
      boa_examples/src/bin/commuter_visitor.rs
  20. 24
      boa_examples/src/bin/futures.rs
  21. 2
      boa_examples/src/bin/jsarraybuffer.rs
  22. 2
      boa_examples/src/bin/jsdate.rs
  23. 2
      boa_examples/src/bin/modules.rs
  24. 2
      boa_examples/src/bin/synthetic.rs
  25. 3
      boa_gc/Cargo.toml
  26. 54
      boa_gc/src/lib.rs
  27. 3
      boa_icu_provider/Cargo.toml
  28. 5
      boa_icu_provider/src/bin/datagen.rs
  29. 54
      boa_icu_provider/src/lib.rs
  30. 3
      boa_interner/Cargo.toml
  31. 53
      boa_interner/src/lib.rs
  32. 3
      boa_macros/Cargo.toml
  33. 53
      boa_macros/src/lib.rs
  34. 2
      boa_macros/tests/tests.rs
  35. 3
      boa_macros_tests/Cargo.toml
  36. 2
      boa_macros_tests/tests/derive/from_js_with.rs
  37. 2
      boa_macros_tests/tests/derive/simple_struct.rs
  38. 2
      boa_macros_tests/tests/tests.rs
  39. 3
      boa_parser/Cargo.toml
  40. 54
      boa_parser/src/lib.rs
  41. 1
      boa_parser/src/parser/tests/test.js
  42. 11
      boa_parser/src/source.rs
  43. 3
      boa_profiler/Cargo.toml
  44. 53
      boa_profiler/src/lib.rs
  45. 3
      boa_runtime/Cargo.toml
  46. 54
      boa_runtime/src/lib.rs
  47. 3
      boa_tester/Cargo.toml
  48. 53
      boa_tester/src/main.rs
  49. 3
      boa_wasm/Cargo.toml
  50. 57
      boa_wasm/src/lib.rs

10
.github/workflows/rust.yml

@ -122,9 +122,15 @@ jobs:
with: with:
key: clippy key: clippy
- name: Clippy (All features) - name: Clippy (All features)
run: cargo workspaces exec cargo clippy --all-features --all-targets -- -D warnings run: cargo workspaces exec cargo clippy --all-features --all-targets
- name: Clippy (No features) - name: Clippy (No features)
run: cargo workspaces exec cargo clippy --no-default-features --all-targets -- -D warnings run: cargo workspaces exec cargo clippy --no-default-features --all-targets
- name: Clippy (Intl)
run: cargo clippy -p boa_engine --features intl
- name: Clippy (Annex-B)
run: cargo clippy -p boa_engine --features annex-b
- name: Clippy (Experimental)
run: cargo clippy -p boa_engine --features experimental
docs: docs:
name: Documentation name: Documentation

57
Cargo.toml

@ -20,7 +20,7 @@ members = [
[workspace.package] [workspace.package]
edition = "2021" edition = "2021"
version = "0.17.0" version = "0.17.0"
rust-version = "1.73.0" rust-version = "1.74.0"
authors = ["boa-dev"] authors = ["boa-dev"]
repository = "https://github.com/boa-dev/boa" repository = "https://github.com/boa-dev/boa"
license = "Unlicense OR MIT" license = "Unlicense OR MIT"
@ -116,3 +116,58 @@ opt-level = 1
lto = "fat" lto = "fat"
# Makes sure that all code is compiled together, for LTO # Makes sure that all code is compiled together, for LTO
codegen-units = 1 codegen-units = 1
[workspace.lints.rust]
# rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings = "warn"
future_incompatible = "warn"
let_underscore = "warn"
nonstandard_style = "warn"
rust_2018_compatibility = "warn"
rust_2018_idioms = "warn"
rust_2021_compatibility = "warn"
unused = "warn"
# rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs = "warn"
macro_use_extern_crate = "warn"
meta_variable_misuse = "warn"
missing_abi = "warn"
missing_copy_implementations = "warn"
missing_debug_implementations = "warn"
non_ascii_idents = "warn"
noop_method_call = "warn"
single_use_lifetimes = "warn"
trivial_casts = "warn"
trivial_numeric_casts = "warn"
unreachable_pub = "warn"
unsafe_op_in_unsafe_fn = "warn"
unused_crate_dependencies = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"
unused_qualifications = "warn"
unused_tuple_struct_fields = "warn"
variant_size_differences = "warn"
[workspace.lints.rustdoc]
# rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
broken_intra_doc_links = "warn"
private_intra_doc_links = "warn"
missing_crate_level_docs = "warn"
private_doc_tests = "warn"
invalid_codeblock_attributes = "warn"
invalid_rust_codeblocks = "warn"
bare_urls = "warn"
[workspace.lints.clippy]
# clippy allowed by default
dbg_macro = "warn"
# clippy categories https://doc.rust-lang.org/clippy/
all = "warn"
correctness = "warn"
suspicious = "warn"
style = "warn"
complexity = "warn"
perf = "warn"
pedantic = "warn"

3
boa_ast/Cargo.toml

@ -24,3 +24,6 @@ num-bigint.workspace = true
serde = { workspace = true, features = ["derive"], optional = true } serde = { workspace = true, features = ["derive"], optional = true }
arbitrary = { workspace = true, features = ["derive"], optional = true } arbitrary = { workspace = true, features = ["derive"], optional = true }
indexmap.workspace = true indexmap.workspace = true
[lints]
workspace = true

6
boa_ast/src/position.rs

@ -141,14 +141,14 @@ mod tests {
/// Checks that we cannot create a position with 0 as the column. /// Checks that we cannot create a position with 0 as the column.
#[test] #[test]
#[should_panic] #[should_panic(expected = "column number cannot be 0")]
fn invalid_position_column() { fn invalid_position_column() {
Position::new(10, 0); Position::new(10, 0);
} }
/// Checks that we cannot create a position with 0 as the line. /// Checks that we cannot create a position with 0 as the line.
#[test] #[test]
#[should_panic] #[should_panic(expected = "line number cannot be 0")]
fn invalid_position_line() { fn invalid_position_line() {
Position::new(0, 10); Position::new(0, 10);
} }
@ -195,7 +195,7 @@ mod tests {
/// Checks that we cannot create an invalid span. /// Checks that we cannot create an invalid span.
#[test] #[test]
#[should_panic] #[should_panic(expected = "a span cannot start after its end")]
fn invalid_span() { fn invalid_span() {
let a = Position::new(10, 30); let a = Position::new(10, 30);
let b = Position::new(10, 50); let b = Position::new(10, 50);

3
boa_cli/Cargo.toml

@ -37,3 +37,6 @@ jemallocator.workspace = true
name = "boa" name = "boa"
doc = false doc = false
path = "src/main.rs" path = "src/main.rs"
[lints]
workspace = true

57
boa_cli/src/main.rs

@ -5,59 +5,6 @@
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![cfg_attr(not(test), deny(clippy::unwrap_used))] #![cfg_attr(not(test), deny(clippy::unwrap_used))]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
mod debug; mod debug;
mod helper; mod helper;
@ -305,7 +252,7 @@ fn generate_flowgraph(
fn evaluate_files( fn evaluate_files(
args: &Opt, args: &Opt,
context: &mut Context, context: &mut Context,
loader: Rc<SimpleModuleLoader>, loader: &SimpleModuleLoader,
) -> Result<(), io::Error> { ) -> Result<(), io::Error> {
for file in &args.files { for file in &args.files {
let buffer = read(file)?; let buffer = read(file)?;
@ -485,7 +432,7 @@ fn main() -> Result<(), io::Error> {
.save_history(CLI_HISTORY) .save_history(CLI_HISTORY)
.expect("could not save CLI history"); .expect("could not save CLI history");
} else { } else {
evaluate_files(&args, &mut context, loader)?; evaluate_files(&args, &mut context, &loader)?;
} }
Ok(()) Ok(())

3
boa_engine/Cargo.toml

@ -133,3 +133,6 @@ bench = false
[[bench]] [[bench]]
name = "full" name = "full"
harness = false harness = false
[lints]
workspace = true

4
boa_engine/benches/full.rs

@ -1,3 +1,5 @@
#![allow(unused_crate_dependencies, missing_docs)]
//! Benchmarks of the whole execution engine in Boa. //! Benchmarks of the whole execution engine in Boa.
use boa_engine::{ use boa_engine::{
@ -17,7 +19,7 @@ static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
fn create_realm(c: &mut Criterion) { fn create_realm(c: &mut Criterion) {
c.bench_function("Create Realm", move |b| { c.bench_function("Create Realm", move |b| {
let root_shape = RootShape::default(); let root_shape = RootShape::default();
b.iter(|| Realm::create(&DefaultHooks, &root_shape)) b.iter(|| Realm::create(&DefaultHooks, &root_shape));
}); });
} }

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

@ -253,7 +253,7 @@ impl OrdinaryFunction {
&self.realm &self.realm
} }
/// Check if function is [`FunctionKind::Ordinary`]. /// Checks if this function is an ordinary function.
pub(crate) fn is_ordinary(&self) -> bool { pub(crate) fn is_ordinary(&self) -> bool {
self.code.is_ordinary() self.code.is_ordinary()
} }

4
boa_engine/src/builtins/intl/locale/utils.rs

@ -499,8 +499,8 @@ fn lookup_supported_locales<M: KeyedDataMarker>(
// 3. Return subset. // 3. Return subset.
requested_locales requested_locales
.iter() .iter()
.cloned()
.filter(|loc| best_available_locale(loc.id.clone(), provider).is_some()) .filter(|loc| best_available_locale(loc.id.clone(), provider).is_some())
.cloned()
.collect() .collect()
} }
@ -517,8 +517,8 @@ fn best_fit_supported_locales<M: KeyedDataMarker>(
) -> Vec<Locale> { ) -> Vec<Locale> {
requested_locales requested_locales
.iter() .iter()
.cloned()
.filter(|loc| best_locale_for_provider(loc.id.clone(), provider).is_some()) .filter(|loc| best_locale_for_provider(loc.id.clone(), provider).is_some())
.cloned()
.collect() .collect()
} }

97
boa_engine/src/builtins/options.rs

@ -124,53 +124,6 @@ pub(crate) enum RoundingMode {
HalfEven, HalfEven,
} }
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum UnsignedRoundingMode {
Infinity,
Zero,
HalfInfinity,
HalfZero,
HalfEven,
}
impl RoundingMode {
pub(crate) const fn negate(self) -> Self {
use RoundingMode::{
Ceil, Expand, Floor, HalfCeil, HalfEven, HalfExpand, HalfFloor, HalfTrunc, Trunc,
};
match self {
Ceil => Self::Floor,
Floor => Self::Ceil,
HalfCeil => Self::HalfFloor,
HalfFloor => Self::HalfCeil,
Trunc => Self::Trunc,
Expand => Self::Expand,
HalfTrunc => Self::HalfTrunc,
HalfExpand => Self::HalfExpand,
HalfEven => Self::HalfEven,
}
}
pub(crate) const fn get_unsigned_round_mode(self, is_negative: bool) -> UnsignedRoundingMode {
use RoundingMode::{
Ceil, Expand, Floor, HalfCeil, HalfEven, HalfExpand, HalfFloor, HalfTrunc, Trunc,
};
match self {
Ceil if !is_negative => UnsignedRoundingMode::Infinity,
Ceil => UnsignedRoundingMode::Zero,
Floor if !is_negative => UnsignedRoundingMode::Zero,
Floor | Trunc | Expand => UnsignedRoundingMode::Infinity,
HalfCeil if !is_negative => UnsignedRoundingMode::HalfInfinity,
HalfCeil | HalfTrunc => UnsignedRoundingMode::HalfZero,
HalfFloor if !is_negative => UnsignedRoundingMode::HalfZero,
HalfFloor | HalfExpand => UnsignedRoundingMode::HalfInfinity,
HalfEven => UnsignedRoundingMode::HalfEven,
}
}
}
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct ParseRoundingModeError; pub(crate) struct ParseRoundingModeError;
@ -217,3 +170,53 @@ impl fmt::Display for RoundingMode {
.fmt(f) .fmt(f)
} }
} }
#[cfg(feature = "temporal")]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum UnsignedRoundingMode {
Infinity,
Zero,
HalfInfinity,
HalfZero,
HalfEven,
}
impl RoundingMode {
#[cfg(feature = "temporal")]
pub(crate) const fn negate(self) -> Self {
use RoundingMode::{
Ceil, Expand, Floor, HalfCeil, HalfEven, HalfExpand, HalfFloor, HalfTrunc, Trunc,
};
match self {
Ceil => Self::Floor,
Floor => Self::Ceil,
HalfCeil => Self::HalfFloor,
HalfFloor => Self::HalfCeil,
Trunc => Self::Trunc,
Expand => Self::Expand,
HalfTrunc => Self::HalfTrunc,
HalfExpand => Self::HalfExpand,
HalfEven => Self::HalfEven,
}
}
#[cfg(feature = "temporal")]
pub(crate) const fn get_unsigned_round_mode(self, is_negative: bool) -> UnsignedRoundingMode {
use RoundingMode::{
Ceil, Expand, Floor, HalfCeil, HalfEven, HalfExpand, HalfFloor, HalfTrunc, Trunc,
};
match self {
Ceil if !is_negative => UnsignedRoundingMode::Infinity,
Ceil => UnsignedRoundingMode::Zero,
Floor if !is_negative => UnsignedRoundingMode::Zero,
Floor | Trunc | Expand => UnsignedRoundingMode::Infinity,
HalfCeil if !is_negative => UnsignedRoundingMode::HalfInfinity,
HalfCeil | HalfTrunc => UnsignedRoundingMode::HalfZero,
HalfFloor if !is_negative => UnsignedRoundingMode::HalfZero,
HalfFloor | HalfExpand => UnsignedRoundingMode::HalfInfinity,
HalfEven => UnsignedRoundingMode::HalfEven,
}
}
}

2
boa_engine/src/builtins/temporal/duration/record.rs

@ -1425,7 +1425,7 @@ impl DurationRecord {
// 2. If zonedRelativeTo is not present, set zonedRelativeTo to undefined. // 2. If zonedRelativeTo is not present, set zonedRelativeTo to undefined.
let zoned_relative_to = relative_targets.1; let zoned_relative_to = relative_targets.1;
// 3. If precalculatedPlainDateTime is not present, set precalculatedPlainDateTime to undefined. // 3. If precalculatedPlainDateTime is not present, set precalculatedPlainDateTime to undefined.
let _precalc_pdt = relative_targets.2; let _ = relative_targets.2;
let (frac_days, frac_secs) = match unit { let (frac_days, frac_secs) = match unit {
// 4. If unit is "year", "month", or "week", and plainRelativeTo is undefined, then // 4. If unit is "year", "month", or "week", and plainRelativeTo is undefined, then

1
boa_engine/src/builtins/typed_array/element/mod.rs

@ -1,5 +1,6 @@
#![deny(unsafe_op_in_unsafe_fn)] #![deny(unsafe_op_in_unsafe_fn)]
#![allow(clippy::cast_ptr_alignment)] // Invariants are checked by the caller. #![allow(clippy::cast_ptr_alignment)] // Invariants are checked by the caller.
#![allow(unused_tuple_struct_fields)] // Weird false-positive with `boa_macros_tests`
mod atomic; mod atomic;

54
boa_engine/src/lib.rs

@ -50,60 +50,8 @@
html_logo_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg", html_logo_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![cfg_attr(test, allow(clippy::needless_raw_string_hashes))] // Makes strings a bit more copy-pastable
#![cfg_attr(not(test), forbid(clippy::unwrap_used))] #![cfg_attr(not(test), forbid(clippy::unwrap_used))]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
#![allow( #![allow(
// Currently throws a false positive regarding dependencies that are only used in benchmarks. // Currently throws a false positive regarding dependencies that are only used in benchmarks.
unused_crate_dependencies, unused_crate_dependencies,

2
boa_engine/src/symbol.rs

@ -151,7 +151,7 @@ unsafe impl Trace for JsSymbol {
macro_rules! well_known_symbols { macro_rules! well_known_symbols {
( $( $(#[$attr:meta])* ($name:ident, $variant:path) ),+$(,)? ) => { ( $( $(#[$attr:meta])* ($name:ident, $variant:path) ),+$(,)? ) => {
$( $(
$(#[$attr])* pub const fn $name() -> JsSymbol { $(#[$attr])* #[must_use] pub const fn $name() -> JsSymbol {
JsSymbol { JsSymbol {
// the cast shouldn't matter since we only have 127 const symbols // the cast shouldn't matter since we only have 127 const symbols
repr: Tagged::from_tag($variant.hash() as usize), repr: Tagged::from_tag($variant.hash() as usize),

38
boa_examples/Cargo.toml

@ -19,3 +19,41 @@ boa_runtime.workspace = true
chrono.workspace = true chrono.workspace = true
smol = "1.3.0" smol = "1.3.0"
futures-util = "0.3.29" futures-util = "0.3.29"
# use explicit lints for examples, since we don't need to lint for docs
[lints.rust]
# rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings = "warn"
future_incompatible = "warn"
let_underscore = "warn"
nonstandard_style = "warn"
rust_2018_compatibility = "warn"
rust_2018_idioms = "warn"
rust_2021_compatibility = "warn"
unused = "warn"
macro_use_extern_crate = "warn"
meta_variable_misuse = "warn"
missing_abi = "warn"
missing_copy_implementations = "warn"
missing_debug_implementations = "warn"
non_ascii_idents = "warn"
noop_method_call = "warn"
single_use_lifetimes = "warn"
trivial_casts = "warn"
trivial_numeric_casts = "warn"
unreachable_pub = "warn"
unsafe_op_in_unsafe_fn = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"
unused_qualifications = "warn"
unused_tuple_struct_fields = "warn"
variant_size_differences = "warn"
[lints.clippy]
all = "warn"
correctness = "warn"
suspicious = "warn"
style = "warn"
complexity = "warn"
perf = "warn"

2
boa_examples/src/bin/classes.rs

@ -85,7 +85,7 @@ impl Class for Person {
} }
/// Here is where the class is initialized. /// Here is where the class is initialized.
fn init(class: &mut ClassBuilder) -> JsResult<()> { fn init(class: &mut ClassBuilder<'_>) -> JsResult<()> {
// We add a inheritable method `sayHello` with `0` arguments of length. // We add a inheritable method `sayHello` with `0` arguments of length.
// //
// This function is added to the `Person` prototype. // This function is added to the `Person` prototype.

2
boa_examples/src/bin/closures.rs

@ -161,7 +161,7 @@ fn main() -> Result<(), JsError> {
// We return the moved variable as a `JsValue`. // We return the moved variable as a `JsValue`.
Ok(JsArray::from_iter( Ok(JsArray::from_iter(
numbers.borrow().iter().cloned().map(JsValue::from), numbers.borrow().iter().copied().map(JsValue::from),
context, context,
) )
.into()) .into())

4
boa_examples/src/bin/commuter_visitor.rs

@ -53,7 +53,7 @@ impl<'ast> VisitorMut<'ast> for CommutorVisitor {
let mut exchanger = OpExchanger::default(); let mut exchanger = OpExchanger::default();
assert!(matches!( assert!(matches!(
exchanger.visit_binary_mut(node), exchanger.visit_binary_mut(node),
ControlFlow::Break(_) ControlFlow::Break(())
)); ));
} }
_ => {} _ => {}
@ -74,7 +74,7 @@ fn main() {
assert!(matches!( assert!(matches!(
visitor.visit_statement_list_mut(script.statements_mut()), visitor.visit_statement_list_mut(script.statements_mut()),
ControlFlow::Continue(_) ControlFlow::Continue(())
)); ));
println!("{}", script.to_interned_string(ctx.interner())); println!("{}", script.to_interned_string(ctx.interner()));

24
boa_examples/src/bin/futures.rs

@ -34,16 +34,16 @@ impl<'a> Queue<'a> {
} }
} }
impl<'a> JobQueue for Queue<'a> { impl JobQueue for Queue<'_> {
fn enqueue_promise_job(&self, job: NativeJob, _context: &mut boa_engine::Context) { fn enqueue_promise_job(&self, job: NativeJob, _context: &mut Context) {
self.jobs.borrow_mut().push_back(job); self.jobs.borrow_mut().push_back(job);
} }
fn enqueue_future_job(&self, future: FutureJob, _context: &mut boa_engine::Context) { fn enqueue_future_job(&self, future: FutureJob, _context: &mut Context) {
self.futures.borrow().push(future) self.futures.borrow().push(future);
} }
fn run_jobs(&self, context: &mut boa_engine::Context) { fn run_jobs(&self, context: &mut Context) {
// Early return in case there were no jobs scheduled. // Early return in case there were no jobs scheduled.
if self.jobs.borrow().is_empty() && self.futures.borrow().is_empty() { if self.jobs.borrow().is_empty() && self.futures.borrow().is_empty() {
return; return;
@ -55,7 +55,7 @@ impl<'a> JobQueue for Queue<'a> {
// Used to sync the finalization of both tasks // Used to sync the finalization of both tasks
let finished = Cell::new(0b00u8); let finished = Cell::new(0b00u8);
let fqueue = async { let fut_queue = async {
loop { loop {
if self.futures.borrow().is_empty() { if self.futures.borrow().is_empty() {
finished.set(finished.get() | 0b01); finished.set(finished.get() | 0b01);
@ -82,7 +82,7 @@ impl<'a> JobQueue for Queue<'a> {
} }
}; };
let jqueue = async { let job_queue = async {
loop { loop {
if self.jobs.borrow().is_empty() { if self.jobs.borrow().is_empty() {
finished.set(finished.get() | 0b10); finished.set(finished.get() | 0b10);
@ -109,8 +109,8 @@ impl<'a> JobQueue for Queue<'a> {
}; };
// Wait for both queues to complete // Wait for both queues to complete
future::zip(fqueue, jqueue).await; future::zip(fut_queue, job_queue).await;
})) }));
} }
} }
@ -126,7 +126,7 @@ fn delay(
let millis = millis?; let millis = millis?;
println!("Delaying for {millis} milliseconds ..."); println!("Delaying for {millis} milliseconds ...");
let now = Instant::now(); let now = Instant::now();
smol::Timer::after(Duration::from_millis(millis as u64)).await; smol::Timer::after(Duration::from_millis(u64::from(millis))).await;
let elapsed = now.elapsed().as_secs_f64(); let elapsed = now.elapsed().as_secs_f64();
Ok(elapsed.into()) Ok(elapsed.into())
} }
@ -163,7 +163,7 @@ fn main() {
add_runtime(context); add_runtime(context);
// Multiple calls to multiple async timers. // Multiple calls to multiple async timers.
let script = r#" let script = r"
function print(elapsed) { function print(elapsed) {
console.log(`Finished. elapsed time: ${elapsed * 1000} ms`) console.log(`Finished. elapsed time: ${elapsed * 1000} ms`)
} }
@ -172,7 +172,7 @@ fn main() {
delay(200).then(print); delay(200).then(print);
delay(600).then(print); delay(600).then(print);
delay(30).then(print); delay(30).then(print);
"#; ";
let now = Instant::now(); let now = Instant::now();
context.eval(Source::from_bytes(script)).unwrap(); context.eval(Source::from_bytes(script)).unwrap();

2
boa_examples/src/bin/jsarraybuffer.rs

@ -17,7 +17,7 @@ fn main() -> JsResult<()> {
// We can now create an typed array to access the data. // We can now create an typed array to access the data.
let uint32_typed_array = JsUint32Array::from_array_buffer(array_buffer, context)?; let uint32_typed_array = JsUint32Array::from_array_buffer(array_buffer, context)?;
let value = 0x12345678u32; let value = 0x1234_5678_u32;
uint32_typed_array.set(0_u64, value, true, context)?; uint32_typed_array.set(0_u64, value, true, context)?;
assert_eq!(uint32_typed_array.get(0_u64, context)?, JsValue::new(value)); assert_eq!(uint32_typed_array.get(0_u64, context)?, JsValue::new(value));

2
boa_examples/src/bin/jsdate.rs

@ -40,7 +40,7 @@ fn main() -> JsResult<()> {
.as_number() .as_number()
.unwrap(); .unwrap();
assert_eq!(timestamp, 823230245000.0); assert_eq!(timestamp, 823_230_245_000.0);
// Gets the current time in UTC time. // Gets the current time in UTC time.
let date = JsDate::new(context); let date = JsDate::new(context);

2
boa_examples/src/bin/modules.rs

@ -93,7 +93,7 @@ fn main() -> Result<(), Box<dyn Error>> {
match promise_result.state() { match promise_result.state() {
PromiseState::Pending => return Err("module didn't execute!".into()), PromiseState::Pending => return Err("module didn't execute!".into()),
PromiseState::Fulfilled(v) => { PromiseState::Fulfilled(v) => {
assert_eq!(v, JsValue::undefined()) assert_eq!(v, JsValue::undefined());
} }
PromiseState::Rejected(err) => { PromiseState::Rejected(err) => {
return Err(JsError::from_opaque(err).try_native(context)?.into()) return Err(JsError::from_opaque(err).try_native(context)?.into())

2
boa_examples/src/bin/synthetic.rs

@ -68,7 +68,7 @@ fn main() -> Result<(), Box<dyn Error>> {
match promise_result.state() { match promise_result.state() {
PromiseState::Pending => return Err("module didn't execute!".into()), PromiseState::Pending => return Err("module didn't execute!".into()),
PromiseState::Fulfilled(v) => { PromiseState::Fulfilled(v) => {
assert_eq!(v, JsValue::undefined()) assert_eq!(v, JsValue::undefined());
} }
PromiseState::Rejected(err) => { PromiseState::Rejected(err) => {
return Err(JsError::from_opaque(err).try_native(context)?.into()) return Err(JsError::from_opaque(err).try_native(context)?.into())

3
boa_gc/Cargo.toml

@ -20,3 +20,6 @@ boa_macros.workspace = true
thin-vec = { workspace = true, optional = true } thin-vec = { workspace = true, optional = true }
hashbrown = { workspace = true, features = ["ahash", "raw"] } hashbrown = { workspace = true, features = ["ahash", "raw"] }
[lints]
workspace = true

54
boa_gc/src/lib.rs

@ -9,60 +9,6 @@
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![cfg_attr(not(test), forbid(clippy::unwrap_used))] #![cfg_attr(not(test), forbid(clippy::unwrap_used))]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
clippy::undocumented_unsafe_blocks,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
#![allow( #![allow(
clippy::module_name_repetitions, clippy::module_name_repetitions,
clippy::redundant_pub_crate, clippy::redundant_pub_crate,

3
boa_icu_provider/Cargo.toml

@ -31,3 +31,6 @@ bin = ["dep:icu_datagen", "dep:simple_logger", "dep:log"]
name = "boa_datagen" name = "boa_datagen"
path = "src/bin/datagen.rs" path = "src/bin/datagen.rs"
required-features = ["bin"] required-features = ["bin"]
[lints]
workspace = true

5
boa_icu_provider/src/bin/datagen.rs

@ -2,6 +2,11 @@
html_logo_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg", html_logo_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![allow(
unused_crate_dependencies,
missing_docs,
rustdoc::missing_crate_level_docs
)]
use std::{error::Error, fs::File}; use std::{error::Error, fs::File};

54
boa_icu_provider/src/lib.rs

@ -19,60 +19,8 @@
html_logo_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg", html_logo_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
#![allow(elided_lifetimes_in_paths)]
#![cfg_attr(not(feature = "bin"), no_std)] #![cfg_attr(not(feature = "bin"), no_std)]
#![allow(unused_crate_dependencies)]
/// Gets the path to the directory where the generated data is stored. /// Gets the path to the directory where the generated data is stored.
#[cfg(feature = "bin")] #[cfg(feature = "bin")]

3
boa_interner/Cargo.toml

@ -25,3 +25,6 @@ indexmap.workspace = true
serde = { workspace = true, features = ["derive"], optional = true } serde = { workspace = true, features = ["derive"], optional = true }
arbitrary = { workspace = true, features = ["derive"], optional = true } arbitrary = { workspace = true, features = ["derive"], optional = true }
hashbrown = { workspace = true, default-features = false, features = ["inline-more"] } hashbrown = { workspace = true, default-features = false, features = ["inline-more"] }
[lints]
workspace = true

53
boa_interner/src/lib.rs

@ -15,59 +15,6 @@
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![cfg_attr(not(test), forbid(clippy::unwrap_used))] #![cfg_attr(not(test), forbid(clippy::unwrap_used))]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
#![allow( #![allow(
clippy::redundant_pub_crate, clippy::redundant_pub_crate,
// TODO deny once false positive is fixed (https://github.com/rust-lang/rust-clippy/issues/9626). // TODO deny once false positive is fixed (https://github.com/rust-lang/rust-clippy/issues/9626).

3
boa_macros/Cargo.toml

@ -16,3 +16,6 @@ quote = "1.0.33"
syn = { version = "2.0.39", features = ["full"] } syn = { version = "2.0.39", features = ["full"] }
proc-macro2 = "1.0" proc-macro2 = "1.0"
synstructure = "0.13" synstructure = "0.13"
[lints]
workspace = true

53
boa_macros/src/lib.rs

@ -5,59 +5,6 @@
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![cfg_attr(not(test), forbid(clippy::unwrap_used))] #![cfg_attr(not(test), forbid(clippy::unwrap_used))]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
use proc_macro::TokenStream; use proc_macro::TokenStream;
use quote::{quote, ToTokens}; use quote::{quote, ToTokens};

2
boa_macros/tests/tests.rs

@ -1,3 +1,5 @@
#![allow(unused_crate_dependencies)]
use boa_macros::utf16; use boa_macros::utf16;
#[test] #[test]

3
boa_macros_tests/Cargo.toml

@ -14,3 +14,6 @@ rust-version.workspace = true
trybuild = "1.0.85" trybuild = "1.0.85"
boa_macros.workspace = true boa_macros.workspace = true
boa_engine.workspace = true boa_engine.workspace = true
[lints]
workspace = true

2
boa_macros_tests/tests/derive/from_js_with.rs

@ -1,3 +1,5 @@
#![allow(unused, unused_tuple_struct_fields)]
use boa_engine::{value::TryFromJs, Context, JsNativeError, JsResult, JsValue}; use boa_engine::{value::TryFromJs, Context, JsNativeError, JsResult, JsValue};
#[derive(TryFromJs)] #[derive(TryFromJs)]

2
boa_macros_tests/tests/derive/simple_struct.rs

@ -1,3 +1,5 @@
#![allow(unused, unused_tuple_struct_fields)]
use boa_engine::value::TryFromJs; use boa_engine::value::TryFromJs;
#[derive(TryFromJs)] #[derive(TryFromJs)]

2
boa_macros_tests/tests/tests.rs

@ -1,3 +1,5 @@
#![allow(unused_crate_dependencies, unused_tuple_struct_fields)]
#[test] #[test]
fn try_from_js() { fn try_from_js() {
let t = trybuild::TestCases::new(); let t = trybuild::TestCases::new();

3
boa_parser/Cargo.toml

@ -26,3 +26,6 @@ icu_properties.workspace = true
[features] [features]
annex-b = [] annex-b = []
temporal = ["boa_ast/temporal"] temporal = ["boa_ast/temporal"]
[lints]
workspace = true

54
boa_parser/src/lib.rs

@ -14,60 +14,8 @@
html_logo_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg", html_logo_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![cfg_attr(test, allow(clippy::needless_raw_string_hashes))] // Makes strings a bit more copy-pastable
#![cfg_attr(not(test), forbid(clippy::unwrap_used))] #![cfg_attr(not(test), forbid(clippy::unwrap_used))]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
#![allow( #![allow(
clippy::module_name_repetitions, clippy::module_name_repetitions,
clippy::too_many_lines, clippy::too_many_lines,

1
boa_parser/src/parser/tests/test.js

@ -0,0 +1 @@
"Hello" + "World";

11
boa_parser/src/source.rs

@ -90,7 +90,7 @@ impl<'path, R: Read> Source<'path, R> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use std::{fs, io::Cursor}; use std::io::Cursor;
#[test] #[test]
fn from_bytes() { fn from_bytes() {
@ -106,15 +106,16 @@ mod tests {
#[test] #[test]
fn from_filepath() { fn from_filepath() {
fs::write("test.js", "'Hello' + 'World';").unwrap(); let manifest_path = Path::new(env!("CARGO_MANIFEST_DIR"));
let mut source = Source::from_filepath("test.js".as_ref()).unwrap(); let filepath = manifest_path.join("src/parser/tests/test.js");
let mut source = Source::from_filepath(&filepath).unwrap();
assert_eq!(source.path, Some("test.js".as_ref())); assert_eq!(source.path, Some(&*filepath));
let mut content = String::new(); let mut content = String::new();
source.reader.read_to_string(&mut content).unwrap(); source.reader.read_to_string(&mut content).unwrap();
assert_eq!(content, "'Hello' + 'World';"); assert_eq!(content, "\"Hello\" + \"World\";\n");
} }
#[test] #[test]

3
boa_profiler/Cargo.toml

@ -17,3 +17,6 @@ profiler = ["dep:measureme", "dep:once_cell", "dep:rustc-hash"]
measureme = { version = "10.1.1", optional = true } measureme = { version = "10.1.1", optional = true }
once_cell = { workspace = true, optional = true, features = ["std"] } once_cell = { workspace = true, optional = true, features = ["std"] }
rustc-hash = { workspace = true, optional = true } rustc-hash = { workspace = true, optional = true }
[lints]
workspace = true

53
boa_profiler/src/lib.rs

@ -12,59 +12,6 @@
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![cfg_attr(not(test), forbid(clippy::unwrap_used))] #![cfg_attr(not(test), forbid(clippy::unwrap_used))]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
#![cfg_attr(not(feature = "profiler"), no_std)] #![cfg_attr(not(feature = "profiler"), no_std)]
use core::fmt::{self, Debug}; use core::fmt::{self, Debug};

3
boa_runtime/Cargo.toml

@ -18,3 +18,6 @@ rustc-hash = { workspace = true, features = ["std"] }
[dev-dependencies] [dev-dependencies]
indoc.workspace = true indoc.workspace = true
textwrap.workspace = true textwrap.workspace = true
[lints]
workspace = true

54
boa_runtime/src/lib.rs

@ -43,60 +43,8 @@
html_logo_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg", html_logo_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![cfg_attr(test, allow(clippy::needless_raw_string_hashes))] // Makes strings a bit more copy-pastable
#![cfg_attr(not(test), forbid(clippy::unwrap_used))] #![cfg_attr(not(test), forbid(clippy::unwrap_used))]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
#![allow( #![allow(
clippy::module_name_repetitions, clippy::module_name_repetitions,
clippy::redundant_pub_crate, clippy::redundant_pub_crate,

3
boa_tester/Cargo.toml

@ -34,3 +34,6 @@ bus = "2.4.1"
[features] [features]
default = ["boa_engine/intl", "boa_engine/experimental", "boa_engine/annex-b"] default = ["boa_engine/intl", "boa_engine/experimental", "boa_engine/annex-b"]
[lints]
workspace = true

53
boa_tester/src/main.rs

@ -8,59 +8,6 @@
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![cfg_attr(not(test), deny(clippy::unwrap_used))] #![cfg_attr(not(test), deny(clippy::unwrap_used))]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
#![allow( #![allow(
clippy::too_many_lines, clippy::too_many_lines,
clippy::redundant_pub_crate, clippy::redundant_pub_crate,

3
boa_wasm/Cargo.toml

@ -25,3 +25,6 @@ default = ["boa_engine/annex-b", "boa_engine/intl", "boa_engine/experimental"]
crate-type = ["cdylib", "lib"] crate-type = ["cdylib", "lib"]
name = "boa_wasm" name = "boa_wasm"
bench = false bench = false
[lints]
workspace = true

57
boa_wasm/src/lib.rs

@ -5,59 +5,6 @@
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg" html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
)] )]
#![cfg_attr(not(test), forbid(clippy::unwrap_used))] #![cfg_attr(not(test), forbid(clippy::unwrap_used))]
#![warn(
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
warnings,
future_incompatible,
let_underscore,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
rust_2021_compatibility,
unused,
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
missing_docs,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
noop_method_call,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_op_in_unsafe_fn,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_tuple_struct_fields,
variant_size_differences,
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
rustdoc::broken_intra_doc_links,
rustdoc::private_intra_doc_links,
rustdoc::missing_crate_level_docs,
rustdoc::private_doc_tests,
rustdoc::invalid_codeblock_attributes,
rustdoc::invalid_rust_codeblocks,
rustdoc::bare_urls,
// clippy allowed by default
clippy::dbg_macro,
// clippy categories https://doc.rust-lang.org/clippy/
clippy::all,
clippy::correctness,
clippy::suspicious,
clippy::style,
clippy::complexity,
clippy::perf,
clippy::pedantic,
)]
use boa_engine::{Context, Source}; use boa_engine::{Context, Source};
use chrono as _; use chrono as _;
@ -70,6 +17,10 @@ fn main() {
} }
/// Evaluate the given ECMAScript code. /// Evaluate the given ECMAScript code.
///
/// # Errors
///
/// If the execution of the script throws, returns a `JsValue` with the error string.
#[wasm_bindgen] #[wasm_bindgen]
pub fn evaluate(src: &str) -> Result<String, JsValue> { pub fn evaluate(src: &str) -> Result<String, JsValue> {
// Setup the executor // Setup the executor

Loading…
Cancel
Save