Skip to content

Commit

Permalink
fix cargo check errors (#1338)
Browse files Browse the repository at this point in the history
* fix cargo check errors

- move constants to associated constants
- format & lint

* remove superfluous use

* use static constant in property

* add parallelism to test262 conformance runs
  • Loading branch information
neeldug authored Jun 19, 2021
1 parent 9497636 commit f673cbc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion boa/src/builtins/bigint/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl BigInt {

/// Converts the BigInt to a f64 type.
///
/// Returns `std::f64::INFINITY` if the BigInt is too big.
/// Returns `f64::INFINITY` if the BigInt is too big.
#[inline]
pub fn to_f64(&self) -> f64 {
self.0.to_f64().unwrap_or(f64::INFINITY)
Expand Down
18 changes: 8 additions & 10 deletions boa/src/builtins/math/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,19 @@ impl BuiltIn for Math {
}

fn init(context: &mut Context) -> (&'static str, Value, Attribute) {
use std::f64;

let _timer = BoaProfiler::global().start_event(Self::NAME, "init");

let attribute = Attribute::READONLY | Attribute::NON_ENUMERABLE | Attribute::PERMANENT;
let string_tag = WellKnownSymbols::to_string_tag();
let object = ObjectInitializer::new(context)
.property("E", f64::consts::E, attribute)
.property("LN2", f64::consts::LN_2, attribute)
.property("LN10", f64::consts::LN_10, attribute)
.property("LOG2E", f64::consts::LOG2_E, attribute)
.property("LOG10E", f64::consts::LOG10_E, attribute)
.property("SQRT1_2", 0.5_f64.sqrt(), attribute)
.property("SQRT2", f64::consts::SQRT_2, attribute)
.property("PI", f64::consts::PI, attribute)
.property("E", std::f64::consts::E, attribute)
.property("LN2", std::f64::consts::LN_2, attribute)
.property("LN10", std::f64::consts::LN_10, attribute)
.property("LOG2E", std::f64::consts::LOG2_E, attribute)
.property("LOG10E", std::f64::consts::LOG10_E, attribute)
.property("SQRT1_2", std::f64::consts::FRAC_1_SQRT_2, attribute)
.property("SQRT2", std::f64::consts::SQRT_2, attribute)
.property("PI", std::f64::consts::PI, attribute)
.function(Self::abs, "abs", 1)
.function(Self::acos, "acos", 1)
.function(Self::acosh, "acosh", 1)
Expand Down
1 change: 1 addition & 0 deletions boa_tester/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ git2 = "0.13.20"
hex = "0.4.3"
num-format = "0.4.0"
gc = { version = "0.4.1", features = ["derive"] }
rayon = "1.5.1"
7 changes: 3 additions & 4 deletions boa_tester/src/exec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use super::{
};
use boa::{parse, Context, Value};
use colored::Colorize;
use rayon::prelude::*;
use std::panic;

impl TestSuite {
Expand All @@ -17,17 +18,15 @@ impl TestSuite {
println!("Suite {}:", self.name);
}

// TODO: in parallel
let suites: Vec<_> = self
.suites
.iter()
.par_iter()
.map(|suite| suite.run(harness, verbose))
.collect();

// TODO: in parallel
let tests: Vec<_> = self
.tests
.iter()
.par_iter()
.map(|test| test.run(harness, verbose))
.flatten()
.collect();
Expand Down

0 comments on commit f673cbc

Please sign in to comment.