From 4b537763a5ce11d13caef18e587530951caeabc4 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 3 Sep 2021 02:24:02 +0200 Subject: [PATCH] Directly connect into Result --- lychee-bin/src/main.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lychee-bin/src/main.rs b/lychee-bin/src/main.rs index 2fbe82f..f275e42 100644 --- a/lychee-bin/src/main.rs +++ b/lychee-bin/src/main.rs @@ -118,13 +118,10 @@ fn run_main() -> Result { // Load excludes from file for path in &opts.config.exclude_file { - let file = File::open(path).expect("No such file"); - opts.config.exclude.append( - &mut io::BufReader::new(file) - .lines() - .map(|l| l.expect("Could not read line")) - .collect(), - ); + let file = File::open(path)?; + opts.config + .exclude + .append(&mut io::BufReader::new(file).lines().collect::>()?); } let cfg = &opts.config;