Skip to content

Commit

Permalink
Removed some clippy warnings in nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican committed Jan 22, 2022
1 parent 96c9fb6 commit 7057a08
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion boa/src/builtins/function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ impl BuiltInFunctionObject {
})?;

let this_arg = args.get_or_undefined(0).clone();
let bound_args = args.get(1..).unwrap_or_else(|| &[]).to_vec();
let bound_args = args.get(1..).unwrap_or(&[]).to_vec();
let arg_count = bound_args.len() as i64;

// 3. Let F be ? BoundFunctionCreate(Target, thisArg, args).
Expand Down
2 changes: 1 addition & 1 deletion boa/src/builtins/map/ordered_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl<V> OrderedMap<V> {
///
/// Computes in **O(1)** time (average).
pub fn get(&self, key: &JsValue) -> Option<&V> {
self.map.get(key).map(Option::as_ref).flatten()
self.map.get(key).and_then(Option::as_ref)
}

/// Get a key-value pair by index.
Expand Down
2 changes: 1 addition & 1 deletion boa/src/builtins/number/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,7 @@ impl Number {
/// Helper function that formats a float as a ES6-style exponential number string.
fn f64_to_exponential(n: f64) -> String {
match n.abs() {
x if x >= 1.0 || x == 0.0 => format!("{:e}", n).replace("e", "e+"),
x if x >= 1.0 || x == 0.0 => format!("{:e}", n).replace('e', "e+"),
_ => format!("{:e}", n),
}
}
Expand Down
3 changes: 1 addition & 2 deletions boa/src/builtins/typed_array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2794,12 +2794,11 @@ impl TypedArray {
// 6. Return name.
Ok(this
.as_object()
.map(|obj| {
.and_then(|obj| {
obj.borrow()
.as_typed_array()
.map(|o| o.typed_array_name().name().into())
})
.flatten()
.unwrap_or(JsValue::Undefined))
}

Expand Down

0 comments on commit 7057a08

Please sign in to comment.