From d5a4f9eefc96c5e15732d69909e80efb84d052ef Mon Sep 17 00:00:00 2001 From: emilpriver Date: Wed, 28 Aug 2024 11:46:27 +0200 Subject: [PATCH] fixed lint --- src/bin/geni/config.rs | 8 +++++--- src/lib/database_drivers/mod.rs | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bin/geni/config.rs b/src/bin/geni/config.rs index d4c6c08..98adace 100644 --- a/src/bin/geni/config.rs +++ b/src/bin/geni/config.rs @@ -80,8 +80,8 @@ pub struct GeniConfig { pub fn load_config_file(project_name: &str) -> Result { let file_path = "./geni.toml"; - if !Path::new(file_path).exists() { - return bail!("{} don't exist", file_path); + if Path::new(file_path).try_exists().is_err() { + bail!("{} don't exist", file_path); } let contents = fs::read_to_string(file_path)?; @@ -94,7 +94,9 @@ pub fn load_config_file(project_name: &str) -> Result { let mut values_iter = v.iter(); match values_iter.find(|p| p.0 == "database_url") { Some((_, database_url)) => { - let database_token = values_iter.find(|p| p.0 == "database_url").map(|(_, dt)| dt.to_string()); + let database_token = values_iter + .find(|p| p.0 == "database_url") + .map(|(_, dt)| dt.to_string()); Ok(GeniConfig { database_url: database_url.to_string(), database_token, diff --git a/src/lib/database_drivers/mod.rs b/src/lib/database_drivers/mod.rs index 07778f2..8ca933e 100644 --- a/src/lib/database_drivers/mod.rs +++ b/src/lib/database_drivers/mod.rs @@ -3,7 +3,6 @@ use anyhow::bail; use serde::{Deserialize, Serialize}; use std::future::Future; use std::pin::Pin; -use std::usize; pub mod libsql; pub mod maria;