From 7b00f9766fe97e5fd58054e336e8d013b17f3486 Mon Sep 17 00:00:00 2001 From: John Meow Date: Sat, 3 Oct 2020 10:25:37 +0300 Subject: [PATCH] Use Result --- src/config.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config.rs b/src/config.rs index 27855cd..37d34ec 100644 --- a/src/config.rs +++ b/src/config.rs @@ -228,17 +228,17 @@ impl Config { .font(self.font.clone().unwrap_or_default()) .round_corner(!self.no_round_corner) .window_controls(!self.no_window_controls) - .shadow_adder(self.get_shadow_adder()) + .shadow_adder(self.get_shadow_adder()?) .tab_width(self.tab_width) .highlight_lines(self.highlight_lines.clone().unwrap_or_default()); Ok(formatter.build()?) } - pub fn get_shadow_adder(&self) -> ShadowAdder { - ShadowAdder::new() + pub fn get_shadow_adder(&self) -> Result { + Ok(ShadowAdder::new() .background(match &self.background_image { - Some(path) => Background::Image(image::open(path).unwrap().to_rgba()), + Some(path) => Background::Image(image::open(path)?.to_rgba()), None => Background::Solid(self.background), }) .shadow_color(self.shadow_color) @@ -246,7 +246,7 @@ impl Config { .pad_horiz(self.pad_horiz) .pad_vert(self.pad_vert) .offset_x(self.shadow_offset_x) - .offset_y(self.shadow_offset_y) + .offset_y(self.shadow_offset_y)) } pub fn get_expanded_output(&self) -> Option {