From a40e41caffe69905d5ec78d0f2800bf0080af71e Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Sat, 28 Jan 2023 21:20:11 +0000 Subject: [PATCH] lints --- Cargo.lock | 8 +------- Cargo.toml | 2 +- atuin-client/src/api_client.rs | 8 ++++---- atuin-client/src/database.rs | 3 ++- atuin-client/src/import/fish.rs | 2 +- atuin-client/src/import/zsh_histdb.rs | 2 +- atuin-client/src/settings.rs | 5 ++--- src/command/client/history.rs | 3 +-- 8 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4438136d..5ebfd2f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,7 +76,7 @@ dependencies = [ "atuin-client", "atuin-common", "atuin-server", - "base64 0.21.0", + "base64 0.20.0", "bitflags", "cassowary", "chrono", @@ -244,12 +244,6 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" -[[package]] -name = "base64" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" - [[package]] name = "beef" version = "0.5.2" diff --git a/Cargo.toml b/Cargo.toml index 34185458..7cb0ad98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,7 @@ tokio = { version = "1", features = ["full"] } async-trait = "0.1.58" interim = { version = "0.1.0", features = ["chrono"] } cli-table = { version = "0.4", default-features = false } -base64 = "0.21.0" +base64 = "0.20.0" crossbeam-channel = "0.5.1" clap = { version = "4.0.18", features = ["derive"] } clap_complete = "4.0.3" diff --git a/atuin-client/src/api_client.rs b/atuin-client/src/api_client.rs index b20d9378..44375c06 100644 --- a/atuin-client/src/api_client.rs +++ b/atuin-client/src/api_client.rs @@ -42,14 +42,14 @@ pub async fn register( map.insert("email", email); map.insert("password", password); - let url = format!("{}/user/{}", address, username); + let url = format!("{address}/user/{username}"); let resp = reqwest::get(url).await?; if resp.status().is_success() { bail!("username already in use"); } - let url = format!("{}/register", address); + let url = format!("{address}/register"); let client = reqwest::Client::new(); let resp = client .post(url) @@ -68,7 +68,7 @@ pub async fn register( } pub async fn login(address: &str, req: LoginRequest) -> Result { - let url = format!("{}/login", address); + let url = format!("{address}/login"); let client = reqwest::Client::new(); let resp = client @@ -111,7 +111,7 @@ pub async fn latest_version() -> Result { impl<'a> Client<'a> { pub fn new(sync_addr: &'a str, session_token: &'a str, key: String) -> Result { let mut headers = HeaderMap::new(); - headers.insert(AUTHORIZATION, format!("Token {}", session_token).parse()?); + headers.insert(AUTHORIZATION, format!("Token {session_token}").parse()?); Ok(Client { sync_addr, diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs index 874c4407..5b817fa8 100644 --- a/atuin-client/src/database.rs +++ b/atuin-client/src/database.rs @@ -448,7 +448,8 @@ impl Database for Sqlite { } else if let Some(term) = query_part.strip_prefix('\'') { format!("{glob}{term}{glob}") } else if is_inverse { - format!("{glob}{term}{glob}", term = query_part) + let term = query_part; + format!("{glob}{term}{glob}") } else { query_part.split("").join(glob) }; diff --git a/atuin-client/src/import/fish.rs b/atuin-client/src/import/fish.rs index 84f4a2f1..850814c7 100644 --- a/atuin-client/src/import/fish.rs +++ b/atuin-client/src/import/fish.rs @@ -31,7 +31,7 @@ fn default_histpath() -> Result { }; let mut histpath = data.join("fish"); - histpath.push(format!("{}_history", session)); + histpath.push(format!("{session}_history")); if histpath.exists() { Ok(histpath) diff --git a/atuin-client/src/import/zsh_histdb.rs b/atuin-client/src/import/zsh_histdb.rs index 16de2a7f..b9bce34d 100644 --- a/atuin-client/src/import/zsh_histdb.rs +++ b/atuin-client/src/import/zsh_histdb.rs @@ -221,7 +221,7 @@ mod test { println!("h: {:#?}", histdb.histdb); println!("counter: {:?}", histdb.histdb.len()); for i in histdb.histdb { - println!("{:?}", i); + println!("{i:?}"); } } } diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index 379237c6..3cefe1cb 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -262,9 +262,8 @@ impl Settings { let data_dir = atuin_common::utils::data_dir(); create_dir_all(&config_dir) - .wrap_err_with(|| format!("could not create dir {:?}", config_dir))?; - create_dir_all(&data_dir) - .wrap_err_with(|| format!("could not create dir {:?}", data_dir))?; + .wrap_err_with(|| format!("could not create dir {config_dir:?}"))?; + create_dir_all(&data_dir).wrap_err_with(|| format!("could not create dir {data_dir:?}"))?; let mut config_file = if let Ok(p) = std::env::var("ATUIN_CONFIG_DIR") { PathBuf::from(p) diff --git a/src/command/client/history.rs b/src/command/client/history.rs index 145fe63a..13d66164 100644 --- a/src/command/client/history.rs +++ b/src/command/client/history.rs @@ -257,8 +257,7 @@ impl Cmd { } (Some(session), Some(cwd)) => { let query = format!( - "select * from history where cwd = '{}' and session = '{}';", - cwd, session + "select * from history where cwd = '{cwd}' and session = '{session}';" ); db.query_history(&query).await? }