use std::{env, process}; use minigrep::Config; fn main() { // args() return iterator // collect() extract iterator to collection we defined for args let args: Vec = env::args().collect(); let config = Config::build(&args).unwrap_or_else(|err| { eprintln!("Problem parsing arguments: {err}"); process::exit(1); }); // we only care about error code since ok will return () // so `if let` is a ideal solution if let Err(e) = minigrep::run(config) { eprintln!("Application error: {e}"); process::exit(1); } }