Skip to content

Commit dfa303b

Browse files
committed
change oob panic to debug assert
1 parent 5795fe3 commit dfa303b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/map.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,10 @@ where
499499
// Handle out-of-bounds indices with panic as this is an internal error in get_index_of.
500500
for idx in indices {
501501
let idx = idx?;
502-
if idx >= len {
503-
panic!("Index is out of range! Got '{idx}' but length is '{len}'")
504-
}
502+
debug_assert!(
503+
idx < len,
504+
"Index is out of range! Got '{idx}' but length is '{len}'"
505+
);
505506
}
506507
let indices = indices.map(Option::unwrap);
507508
let entries = self.get_many_index_mut(indices)?;

0 commit comments

Comments
 (0)