Handle insufficient arguments using panic!
This commit is contained in:
parent
bc20afefa1
commit
dd00502383
1 changed files with 4 additions and 0 deletions
|
@ -22,6 +22,10 @@ struct Config {
|
|||
|
||||
impl Config {
|
||||
fn new(args: &[String]) -> Config {
|
||||
if args.len() < 3 {
|
||||
panic!("not enough arguments");
|
||||
}
|
||||
|
||||
let query = args[1].clone();
|
||||
let file_path = args[2].clone();
|
||||
|
||||
|
|
Loading…
Reference in a new issue