rustlings
rustlings copied to clipboard
option1.rs is too easy to pass
Description
Total-beyond-newbie here, but I noticed option1.rs
is too easy to pass.
This passes the test:
pub fn pop_too_much() -> bool {
let mut list = vec![3];
let last = list.pop().unwrap();
println!("The last item in the list is {:?}", last);
- let second_to_last = list.pop().unwrap();
+ let second_to_last = list.pop();
println!(
"The second-to-last item in the list is {:?}",
second_to_last
);
true
}
Maybe there's some opportunity for a better test? I'm forcing myself to read the hints, just so I can understand/learn the lesson to be had in this file. 😅
Feel free to close if this is not helpful for for rustlings, or the community!
I've just noticed this: if you try to compile variables6.rs, the compiler tells the solution.
As there is two option1 exercises, which is weird as there can be only one hint, I assume this errors/option1.rs is an accidental leftover from the time before there was a whole section for Option.
Error_Handling/option1.rs is not included in rustlings watch. So i suppose Lynoure is right.