From 13b78e82f0cff057cd465ce11d48b953c8c0263b Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Fri, 16 Dec 2022 18:05:06 +0100 Subject: [PATCH 1/3] Fix rust 1.66.0 lints --- boa_cli/src/main.rs | 4 ++-- boa_engine/src/builtins/function/mod.rs | 2 +- boa_engine/src/lib.rs | 2 +- boa_engine/src/tests.rs | 2 +- boa_engine/src/vm/flowgraph/color.rs | 6 +++--- boa_engine/src/vm/flowgraph/graph.rs | 4 ++-- boa_engine/src/vm/flowgraph/mod.rs | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/boa_cli/src/main.rs b/boa_cli/src/main.rs index 57f3cf3860a..e6be35dffa3 100644 --- a/boa_cli/src/main.rs +++ b/boa_cli/src/main.rs @@ -272,7 +272,7 @@ fn main() -> Result<(), io::Error> { flowgraph.unwrap_or(FlowgraphFormat::Graphviz), args.flowgraph_direction, ) { - Ok(v) => println!("{}", v), + Ok(v) => println!("{v}"), Err(v) => eprintln!("Uncaught {v}"), } } else { @@ -328,7 +328,7 @@ fn main() -> Result<(), io::Error> { flowgraph.unwrap_or(FlowgraphFormat::Graphviz), args.flowgraph_direction, ) { - Ok(v) => println!("{}", v), + Ok(v) => println!("{v}"), Err(v) => eprintln!("Uncaught {v}"), } } else { diff --git a/boa_engine/src/builtins/function/mod.rs b/boa_engine/src/builtins/function/mod.rs index 2edb19c69f7..0c16c1e2113 100644 --- a/boa_engine/src/builtins/function/mod.rs +++ b/boa_engine/src/builtins/function/mod.rs @@ -1017,7 +1017,7 @@ fn set_function_name( ) } PropertyKey::String(string) => string.clone(), - PropertyKey::Index(index) => js_string!(format!("{}", index)), + PropertyKey::Index(index) => js_string!(format!("{index}")), }; // 3. Else if name is a Private Name, then diff --git a/boa_engine/src/lib.rs b/boa_engine/src/lib.rs index c8a7b79007b..d4a9181f75c 100644 --- a/boa_engine/src/lib.rs +++ b/boa_engine/src/lib.rs @@ -160,7 +160,7 @@ where { context .eval(src.as_ref()) - .map_or_else(|e| format!("Uncaught {}", e), |v| v.display().to_string()) + .map_or_else(|e| format!("Uncaught {e}"), |v| v.display().to_string()) } /// Execute the code using an existing Context. diff --git a/boa_engine/src/tests.rs b/boa_engine/src/tests.rs index 0e0b3a7e00a..2c43e54240f 100644 --- a/boa_engine/src/tests.rs +++ b/boa_engine/src/tests.rs @@ -2091,7 +2091,7 @@ fn bigger_switch_example() { "#, ); - assert_eq!(&exec(&scenario), val); + assert_eq!(&exec(scenario), val); } } diff --git a/boa_engine/src/vm/flowgraph/color.rs b/boa_engine/src/vm/flowgraph/color.rs index ade9ad73ffc..1caee94486f 100644 --- a/boa_engine/src/vm/flowgraph/color.rs +++ b/boa_engine/src/vm/flowgraph/color.rs @@ -33,10 +33,10 @@ impl Color { #[must_use] pub fn hsv_to_rgb(h: f64, s: f64, v: f64) -> Self { let h_i = (h * 6.0) as i64; - let f = h * 6.0 - h_i as f64; + let f = h.mul_add(6.0, -h_i as f64); let p = v * (1.0 - s); - let q = v * (1.0 - f * s); - let t = v * (1.0 - (1.0 - f) * s); + let q = v * f.mul_add(-s, 1.0); + let t = v * (1.0 - f).mul_add(-s, 1.0); let (r, g, b) = match h_i { 0 => (v, t, p), diff --git a/boa_engine/src/vm/flowgraph/graph.rs b/boa_engine/src/vm/flowgraph/graph.rs index b400e98a726..78374f83bea 100644 --- a/boa_engine/src/vm/flowgraph/graph.rs +++ b/boa_engine/src/vm/flowgraph/graph.rs @@ -175,7 +175,7 @@ impl SubGraph { self.label.as_ref() } )); - result.push_str(&format!(" direction {}\n", rankdir)); + result.push_str(&format!(" direction {rankdir}\n")); result.push_str(&format!(" {prefix}_{}_start{{Start}}\n", self.label)); result.push_str(&format!( @@ -302,7 +302,7 @@ impl Graph { Direction::LeftToRight => "LR", Direction::RightToLeft => "RL", }; - result += &format!("graph {}\n", rankdir); + result += &format!("graph {rankdir}\n"); for subgraph in &self.subgraphs { subgraph.mermaid_format(&mut result, ""); diff --git a/boa_engine/src/vm/flowgraph/mod.rs b/boa_engine/src/vm/flowgraph/mod.rs index 36a17f27772..5b2de3d2a9c 100644 --- a/boa_engine/src/vm/flowgraph/mod.rs +++ b/boa_engine/src/vm/flowgraph/mod.rs @@ -92,7 +92,7 @@ impl CodeBlock { pc += size_of::(); let operand_str = self.literals[operand as usize].display().to_string(); let operand_str = operand_str.escape_debug(); - let label = format!("{opcode_str} {}", operand_str); + let label = format!("{opcode_str} {operand_str}"); graph.add_node(previous_pc, NodeShape::None, label.into(), Color::None); graph.add_edge(previous_pc, pc, None, Color::None, EdgeStyle::Line); From 8d478197efb6d3cbfb15d6829ee90776a8c73cdf Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Fri, 16 Dec 2022 18:19:55 +0100 Subject: [PATCH 2/3] Fix rustdoc lints --- boa_engine/src/vm/opcode/mod.rs | 10 +++++----- boa_parser/src/parser/expression/mod.rs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/boa_engine/src/vm/opcode/mod.rs b/boa_engine/src/vm/opcode/mod.rs index 9f77d3b2338..069b46f73fc 100644 --- a/boa_engine/src/vm/opcode/mod.rs +++ b/boa_engine/src/vm/opcode/mod.rs @@ -439,7 +439,7 @@ generate_impl! { /// /// Operands: /// - /// Stack: lhs, rhs **=>** (lhs << rhs) + /// Stack: lhs, rhs **=>** `(lhs << rhs)` ShiftLeft, /// Binary `>>>` operator. @@ -530,14 +530,14 @@ generate_impl! { /// /// Operands: /// - /// Stack: lhs, rhs **=>** (lhs < rhs) + /// Stack: lhs, rhs **=>** `(lhs < rhs)` LessThan, /// Binary `<=` operator. /// /// Operands: /// - /// Stack: lhs, rhs **=>** (lhs <= rhs) + /// Stack: lhs, rhs **=>** `(lhs <= rhs)` LessThanOrEq, /// Binary `instanceof` operator. @@ -1418,7 +1418,7 @@ generate_impl! { /// /// Operands: /// - /// Stack: received **=>** Option, skip_0, skip_1 + /// Stack: received **=>** `Option`, skip_0, skip_1 AsyncGeneratorNext, /// Delegates the current generator function another generator. @@ -1448,7 +1448,7 @@ generate_impl! { /// /// Stack: **=>** // Safety: Must be last in the list since, we use this for range checking - // in TryFrom impl. + // in `TryFrom` impl. Nop, } } diff --git a/boa_parser/src/parser/expression/mod.rs b/boa_parser/src/parser/expression/mod.rs index fa47b764218..5e3e3c0d0a9 100644 --- a/boa_parser/src/parser/expression/mod.rs +++ b/boa_parser/src/parser/expression/mod.rs @@ -65,9 +65,9 @@ pub(in crate::parser) use { /// - The `$name` identifier is the name of the `TargetExpression` struct that the parser will be implemented for. /// - The `$lower` identifier is the name of the `InnerExpression` struct according to the pattern above. /// -/// A list of punctuators (operands between the and ) are passed as the third parameter. +/// A list of punctuators (operands between the `TargetExpression` and `InnerExpression`) are passed as the third parameter. /// -/// The fifth parameter is an Option which sets the goal symbol to set before parsing (or None to leave it as is). +/// The fifth parameter is an `Option` which sets the goal symbol to set before parsing (or None to leave it as is). macro_rules! expression { ($name:ident, $lower:ident, [$( $op:path ),*], [$( $low_param:ident ),*], $goal:expr ) => { impl TokenParser for $name From 566468913374eaa923b60bcb0b775abb8a0c9bcc Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Fri, 16 Dec 2022 21:16:01 +0100 Subject: [PATCH 3/3] bump rustc version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1a59dcd481d..48aed516ce0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ members = [ [workspace.package] edition = "2021" version = "0.16.0" -rust-version = "1.65" +rust-version = "1.66" authors = ["boa-dev"] repository = "https://github.com/boa-dev/boa" license = "Unlicense/MIT"