Skip to content

Commit

Permalink
Fix rust 1.66.0 lints (#2486)
Browse files Browse the repository at this point in the history
This Pull Request fixes the new lints introduced in clippy 1.66.0.
  • Loading branch information
raskad committed Dec 17, 2022
1 parent ffce18a commit e3d35e9
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions boa_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2091,7 +2091,7 @@ fn bigger_switch_example() {
"#,
);

assert_eq!(&exec(&scenario), val);
assert_eq!(&exec(scenario), val);
}
}

Expand Down
6 changes: 3 additions & 3 deletions boa_engine/src/vm/flowgraph/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions boa_engine/src/vm/flowgraph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down Expand Up @@ -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, "");
Expand Down
2 changes: 1 addition & 1 deletion boa_engine/src/vm/flowgraph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl CodeBlock {
pc += size_of::<u32>();
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);
Expand Down
10 changes: 5 additions & 5 deletions boa_engine/src/vm/opcode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ generate_impl! {
///
/// Operands:
///
/// Stack: lhs, rhs **=>** (lhs << rhs)
/// Stack: lhs, rhs **=>** `(lhs << rhs)`
ShiftLeft,

/// Binary `>>>` operator.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -1418,7 +1418,7 @@ generate_impl! {
///
/// Operands:
///
/// Stack: received **=>** Option<value>, skip_0, skip_1
/// Stack: received **=>** `Option<value>`, skip_0, skip_1
AsyncGeneratorNext,

/// Delegates the current generator function another generator.
Expand Down Expand Up @@ -1448,7 +1448,7 @@ generate_impl! {
///
/// Stack: **=>**
// Safety: Must be last in the list since, we use this for range checking
// in TryFrom<u8> impl.
// in `TryFrom<u8>` impl.
Nop,
}
}
Expand Down
4 changes: 2 additions & 2 deletions boa_parser/src/parser/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <TargetExpression> and <InnerExpression>) 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<InputElement> which sets the goal symbol to set before parsing (or None to leave it as is).
/// The fifth parameter is an `Option<InputElement>` 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<R> TokenParser<R> for $name
Expand Down

0 comments on commit e3d35e9

Please sign in to comment.