diff --git a/boa_engine/src/builtins/array_buffer/mod.rs b/boa_engine/src/builtins/array_buffer/mod.rs index 3f0524017d..b4d59d1f4b 100644 --- a/boa_engine/src/builtins/array_buffer/mod.rs +++ b/boa_engine/src/builtins/array_buffer/mod.rs @@ -764,7 +764,7 @@ pub fn create_byte_data_block(size: usize, context: &mut Context) -> JsResult, + to_block: &mut [u8], mut to_index: usize, from_block: &[u8], mut from_index: usize, diff --git a/boa_engine/src/builtins/regexp/mod.rs b/boa_engine/src/builtins/regexp/mod.rs index b39d66a8a9..6bc784e0b4 100644 --- a/boa_engine/src/builtins/regexp/mod.rs +++ b/boa_engine/src/builtins/regexp/mod.rs @@ -1386,7 +1386,9 @@ impl RegExp { // the substring of S from nextSourcePosition to position, and replacement. accumulated_result = format!( "{accumulated_result}{}{replacement}", - arg_str.get(next_source_position..position).unwrap(), + arg_str + .get(next_source_position..position) + .expect("index of a regexp match cannot be greater than the input string"), ) .into(); @@ -1404,7 +1406,9 @@ impl RegExp { Ok(format!( "{}{}", accumulated_result, - arg_str.get(next_source_position..).unwrap() + arg_str + .get(next_source_position..) + .expect("next_source_position cannot be greater than the input string") ) .into()) } diff --git a/boa_engine/src/value/display.rs b/boa_engine/src/value/display.rs index 2e6d8855b7..1cee752262 100644 --- a/boa_engine/src/value/display.rs +++ b/boa_engine/src/value/display.rs @@ -117,8 +117,7 @@ pub(crate) fn log_string_from(x: &JsValue, print_internals: bool, print_children .borrow() .properties() .get(&PropertyKey::from("length")) - // TODO: do this in a better way `unwrap` - .unwrap() + .expect("array object must have 'length' property") // FIXME: handle accessor descriptors .expect_value() .as_number()