I noticed a possible panic in im-rs/src/vector/mod.rs. Although the documentation mentioned it will panic if the index is out of bounds, the code does not check whether index is out of bounds before using it as out[index], self[index]. So I think the code should check it before(using get()).
/// Panics if the index is out of bounds.
///
/// Time: O(log n)
///
/// # Examples
///
/// ```
/// # #[macro_use] extern crate im;
/// # use im::Vector;
/// let mut vec = vector![1, 2, 3];
/// assert_eq!(vector![1, 5, 3], vec.update(1, 5));
/// ```
#[must_use]
pub fn update(&self, index: usize, value: A) -> Self {
let mut out = self.clone();
out[index] = value;
out
}
/// Update the value at index `index` in a vector.
///
/// Returns the previous value at the index.
///
/// Panics if the index is out of bounds.
///
/// Time: O(log n)
#[inline]
pub fn set(&mut self, index: usize, value: A) -> A {
replace(&mut self[index], value)
}
I noticed a possible panic in im-rs/src/vector/mod.rs. Although the documentation mentioned it will panic if the index is out of bounds, the code does not check whether index is out of bounds before using it as out[index], self[index]. So I think the code should check it before(using get()).