From 92a201981aa2ca147ddec586a243aaf43a15df9c Mon Sep 17 00:00:00 2001 From: Valerie Date: Tue, 9 Jul 2024 09:55:35 -0400 Subject: [PATCH] minor refactor --- src/operation.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/operation.rs b/src/operation.rs index e267627..ecd1e84 100644 --- a/src/operation.rs +++ b/src/operation.rs @@ -92,8 +92,7 @@ pub fn build(targets: &Vec>, template_dir: String, config: &C let content = read_to_string(path).unwrap(); let template = engine.compile(&content); - if template.is_err() { - let error = template.err().unwrap(); + if let Err(error) = template { println!(" {BOLD}{FAILURE}failed to compile template:{RESET}\n {FAILURE}{error}\n {BOLD}skipping{RESET}"); continue; } @@ -101,8 +100,7 @@ pub fn build(targets: &Vec>, template_dir: String, config: &C // render println!(" {ITALIC}rendering{RESET}"); let render = template.unwrap().render(&context).to_string(); - if render.is_err() { - let error = render.err().unwrap(); + if let Err(error) = render { println!(" {BOLD}{FAILURE}failed to render template:{RESET}\n {FAILURE}{error}\n {BOLD}skipping{RESET}"); continue; }