Try to make clippy happy 🥺 (#686)

* Try to make clippy happy 🥺

* Fmt

* I missed one (can't run clippy locally on airport wifi...)
This commit is contained in:
Ellie Huxtable 2023-02-06 12:59:01 +01:00 committed by GitHub
parent 4aa2011e0e
commit 3abc96fafe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 11 deletions

View File

@ -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<LoginResponse> {
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<Version> {
impl<'a> Client<'a> {
pub fn new(sync_addr: &'a str, session_token: &'a str, key: String) -> Result<Self> {
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,

View File

@ -448,7 +448,7 @@ 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)
format!("{glob}{query_part}{glob}")
} else {
query_part.split("").join(glob)
};

View File

@ -31,7 +31,7 @@ fn default_histpath() -> Result<PathBuf> {
};
let mut histpath = data.join("fish");
histpath.push(format!("{}_history", session));
histpath.push(format!("{session}_history"));
if histpath.exists() {
Ok(histpath)

View File

@ -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)

View File

@ -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?
}