From bc46764e2f8ee2c58588d76b96edcd353a92139a Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Wed, 21 Jul 2021 22:19:28 +0100 Subject: [PATCH] Fix clippy linter errors --- agb-image-converter/src/config.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/agb-image-converter/src/config.rs b/agb-image-converter/src/config.rs index c2570f39..4d6b3bf4 100644 --- a/agb-image-converter/src/config.rs +++ b/agb-image-converter/src/config.rs @@ -5,7 +5,7 @@ use std::fs; use crate::{TileSize, Colour}; pub(crate) fn parse(filename: &str) -> Box { - let config_toml = fs::read_to_string(filename).expect(&format!("Failed to read file {}", filename)); + let config_toml = fs::read_to_string(filename).unwrap_or_else(|_| panic!("Failed to read file {}", filename)); let config: ConfigV1 = toml::from_str(&config_toml).expect("Failed to parse file"); @@ -37,7 +37,7 @@ pub struct ConfigV1 { impl Config for ConfigV1 { fn crate_prefix(&self) -> String { - self.crate_prefix.clone().unwrap_or("agb".to_owned()) + self.crate_prefix.clone().unwrap_or_else(|| "agb".to_owned()) } fn images(&self) -> HashMap { @@ -89,11 +89,11 @@ pub enum TileSizeV1 { Tile16, } -impl Into for TileSizeV1 { - fn into(self) -> TileSize { - match self { +impl From for TileSize { + fn from(item: TileSizeV1) -> Self { + match item { TileSizeV1::Tile8 => TileSize::Tile8, TileSizeV1::Tile16 => TileSize::Tile16, } } -} \ No newline at end of file +}