From 009bb0cb96a97f132e44cc6389371a83642b042e Mon Sep 17 00:00:00 2001 From: Manuel Thalmann <m@nuth.ch> Date: Wed, 19 Mar 2025 08:12:38 +0100 Subject: [PATCH] Extract the main logic --- minigrep/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/minigrep/src/main.rs b/minigrep/src/main.rs index 17a0073..018a838 100644 --- a/minigrep/src/main.rs +++ b/minigrep/src/main.rs @@ -13,6 +13,10 @@ fn main() { println!("Searching for {}", config.query); println!("In file {}", config.file_path); + run(config); +} + +fn run(config: Config) { let contents = fs::read_to_string(config.file_path) .expect("Should have been able to read the file");