From 5efc48ec310ac8e87d4035fc9ebf84c6772e8edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20=C5=A0ula?= Date: Fri, 14 Jan 2022 16:56:32 +0100 Subject: [PATCH] fix: change if statement to let Some, remove unnecessary import --- src/config.rs | 6 +++--- src/frontend/parser.rs | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/config.rs b/src/config.rs index 0363696a..e749611a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -296,11 +296,11 @@ pub enum HtmlMathmode { impl Config { /// [`validate_config`] validates if file and paths exist and if config does not contradict itself pub fn validate_config(&mut self) -> Result<(), UmError> { - if self.out_file.is_some() { - if !self.out_file.as_ref().unwrap().exists() { + if let Some(ref file) = self.out_file { + if !file.exists() { let msg = format!( "output_file: {} is not a valid file", - self.out_file.as_ref().unwrap().to_str().unwrap() + file.to_string_lossy() ); return Err(UmError::Backend(BackendError::new(msg))); } else if !self.overwrite_out_files { diff --git a/src/frontend/parser.rs b/src/frontend/parser.rs index dfc66a2c..2164ddec 100644 --- a/src/frontend/parser.rs +++ b/src/frontend/parser.rs @@ -4,7 +4,6 @@ use pest::{iterators::Pair, iterators::Pairs, Parser, Span}; use pest_derive::Parser; use std::fs; -use crate::config; use crate::um_error::UmError; use crate::{ config::Config,