Skip to content

Commit

Permalink
rustfmt dat sh*t
Browse files Browse the repository at this point in the history
  • Loading branch information
Nimpruda committed Oct 21, 2021
1 parent 3de3d0e commit 83c95d2
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions boa/src/builtins/dataview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl DataView {
let buffer = buffer_borrow
.as_array_buffer()
.ok_or_else(|| context.construct_type_error("buffer must be an ArrayBuffer"))?;

// 3. Let offset be ? ToIndex(byteOffset).
let offset = args.get_or_undefined(1).to_index(context)?;
// 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
Expand Down Expand Up @@ -155,10 +155,11 @@ impl DataView {

// 10. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
if buffer_obj
.borrow()
.as_array_buffer()
.ok_or_else(|| context.construct_type_error("buffer must be an ArrayBuffer"))?
.is_detached_buffer() {
.borrow()
.as_array_buffer()
.ok_or_else(|| context.construct_type_error("buffer must be an ArrayBuffer"))?
.is_detached_buffer()
{
return context.throw_type_error("ArrayBuffer can't be detached");
}

Expand Down Expand Up @@ -195,11 +196,11 @@ impl DataView {
) -> JsResult<JsValue> {
// 1. Let O be the this value.
// 2. Perform ? RequireInternalSlot(O, [[DataView]]).
let dataview = this.as_object().map(|obj| obj.borrow());
let dataview = this.as_object().map(|obj| obj.borrow());
let dataview = dataview
.as_ref()
.and_then(|obj| obj.as_data_view())
.ok_or_else(|| context.construct_type_error("`this` is not a DataView"))?;
.as_ref()
.and_then(|obj| obj.as_data_view())
.ok_or_else(|| context.construct_type_error("`this` is not a DataView"))?;
// 3. Assert: O has a [[ViewedArrayBuffer]] internal slot.
// 4. Let buffer be O.[[ViewedArrayBuffer]].
let buffer = dataview.viewed_array_buffer.clone();
Expand Down

0 comments on commit 83c95d2

Please sign in to comment.