ferrous-systems / rust-training

Learning materials for the Rust Training courses by Ferrous Systems
144 stars 19 forks source link

`vec!` is used early in the slides #56

Closed amanjeev closed 1 year ago

amanjeev commented 1 year ago

Where

In the slide titled: Shorthand: while let conditionals

What

Code uses vec!

fn main() {
    let mut numbers = vec![1, 2, 3];  // <----- not good here because used early and potentially confusing
    while let Some(num) = numbers.pop() {
        println!("popped number {}", num);
    }
}

Fix

  1. use the usual non-macro way to create Vec
  2. perhaps move this slide later?
    ### Tasks
    - [ ] use the usual non-macro way to create Vec
    - [ ] use the usual non-macro way to create Vec