~irimi1/learning-rust

5e4c5c99cba200ddfcbe1573278b5d63940040b8 — Manuel Groß 2 years ago eb12df6
minigrep: Check number of args before parsing
1 files changed, 3 insertions(+), 0 deletions(-)

M projects/minigrep/src/main.rs
M projects/minigrep/src/main.rs => projects/minigrep/src/main.rs +3 -0
@@ 22,6 22,9 @@ struct Config {

impl Config {
    fn new(args: &[String]) -> Config {
        if args.len() < 3 {
            panic!("Not enough arguments");
        }
        let query = args[1].clone();
        let filename = args[2].clone();