Out of bound for vectors
- Run-time panic
#[allow(clippy::useless_vec)]
fn main() {
let v = vec!["apple", "banana", "peach"];
println!("{}", v[0]);
println!("{}", v[5]);
}
apple
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 5', examples/errors/out_of_bounds_vector.rs:4:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace