Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style: Respect rustfmft #1356

Merged
merged 1 commit into from
Jun 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions boa/src/builtins/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,9 @@ impl Array {
let arg_count = args.len();

if length + arg_count > Number::MAX_SAFE_INTEGER as usize {
return context.throw_type_error("the length + the number of arguments exceed the maximum safe integer limit");
return context.throw_type_error(
"the length + the number of arguments exceed the maximum safe integer limit",
);
}

let new_array = Self::add_to_array_object(this, args, context)?;
Expand Down Expand Up @@ -696,7 +698,9 @@ impl Array {

if arg_c > 0 {
if len + arg_c > Number::MAX_SAFE_INTEGER as usize {
return context.throw_type_error("the length + the number of arguments exceed the maximum safe integer limit");
return context.throw_type_error(
"the length + the number of arguments exceed the maximum safe integer limit",
);
}
for k in (1..=len).rev() {
let from = k.wrapping_sub(1);
Expand Down Expand Up @@ -1279,7 +1283,7 @@ impl Array {
};

let k = match n {
num if num >= 0 => num as usize, // if n>=0 -> k=n
num if num >= 0 => num as usize, // if n>=0 -> k=n
num if -num as usize > length => 0, // if n<0 -> k= max(length + n, 0)
_ => length - (-n as usize), // this is `length + n` but is necessary for typing reasons
};
Expand Down