From 12cd3df661cd73bdf93b5ed80d6ebe793d8cfa40 Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Mon, 26 Feb 2024 08:51:27 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20Passes=20fm?= =?UTF-8?q?t=20and=20clippy=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.rs | 6 ++++++ src/config/file.rs | 2 +- src/config/file/source.rs | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app.rs b/src/app.rs index 9d30f421..9c8b4e98 100644 --- a/src/app.rs +++ b/src/app.rs @@ -20,6 +20,12 @@ use std::io::Error; pub struct Application; +impl Default for Application { + fn default() -> Self { + Self::new() + } +} + impl Application { /// Creates a new application instance without any package. pub fn new() -> Self { diff --git a/src/config/file.rs b/src/config/file.rs index b644d196..6f760e36 100644 --- a/src/config/file.rs +++ b/src/config/file.rs @@ -70,7 +70,7 @@ where let (uri, contents) = match self .source .resolve() - .map_err(|err| ConfigError::Foreign(err)) + .map_err(ConfigError::Foreign) { Ok((uri, contents)) => (uri, contents), diff --git a/src/config/file/source.rs b/src/config/file/source.rs index 80052c87..46d9ff00 100644 --- a/src/config/file/source.rs +++ b/src/config/file/source.rs @@ -27,7 +27,7 @@ impl FileSourceFile { // First check for an _exact_ match. let mut filename = env::current_dir()?.as_path().join(self.name.clone()); if filename.is_file() { - if vec!["toml"].contains( + if ["toml"].contains( &filename .extension() .unwrap_or_default() @@ -108,8 +108,8 @@ fn path_relative_from(path: &Path, base: &Path) -> Option { } (None, _) => comps.push(Component::ParentDir), (Some(a), Some(b)) if comps.is_empty() && a == b => (), - (Some(a), Some(b)) if b == Component::CurDir => comps.push(a), - (Some(_), Some(b)) if b == Component::ParentDir => return None, + (Some(a), Some(Component::CurDir)) => comps.push(a), + (Some(_), Some(Component::ParentDir)) => return None, (Some(a), Some(_)) => { comps.push(Component::ParentDir); for _ in itb {