rustlings icon indicating copy to clipboard operation
rustlings copied to clipboard

option1.rs is too easy to pass

Open thiskevinwang opened this issue 4 years ago • 3 comments

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!

thiskevinwang avatar Mar 22 '20 04:03 thiskevinwang

I've just noticed this: if you try to compile variables6.rs, the compiler tells the solution.

Zoldszemesostoros avatar May 26 '20 19:05 Zoldszemesostoros

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.

lynoure avatar Jun 14 '20 19:06 lynoure

Error_Handling/option1.rs is not included in rustlings watch. So i suppose Lynoure is right.

muisje avatar Jun 16 '20 21:06 muisje