From dd005023831453310c3cd9f78713f10a24ec56d2 Mon Sep 17 00:00:00 2001
From: Manuel Thalmann <m@nuth.ch>
Date: Wed, 19 Mar 2025 00:17:59 +0100
Subject: [PATCH] Handle insufficient arguments using `panic!`

---
 minigrep/src/main.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/minigrep/src/main.rs b/minigrep/src/main.rs
index 018ea83..1ed6967 100644
--- a/minigrep/src/main.rs
+++ b/minigrep/src/main.rs
@@ -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();