Skip to content

Commit

Permalink
Fix rust 1.60 clippy lints (#2014)
Browse files Browse the repository at this point in the history
This Pull Request fixes new / improved clippy lints with rust 1.60.
  • Loading branch information
raskad committed Apr 8, 2022
1 parent 2239669 commit 5ab3bf8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion boa_engine/src/builtins/array_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ pub fn create_byte_data_block(size: usize, context: &mut Context) -> JsResult<Ve
///
/// [spec]: https://tc39.es/ecma262/#sec-copydatablockbytes
fn copy_data_block_bytes(
to_block: &mut Vec<u8>,
to_block: &mut [u8],
mut to_index: usize,
from_block: &[u8],
mut from_index: usize,
Expand Down
8 changes: 6 additions & 2 deletions boa_engine/src/builtins/regexp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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())
}
Expand Down
3 changes: 1 addition & 2 deletions boa_engine/src/value/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5ab3bf8

Please sign in to comment.