This commit is contained in:
Conrad Ludgate 2023-01-28 21:20:11 +00:00
parent 7b30466f45
commit a40e41caff
No known key found for this signature in database
GPG Key ID: 197E3CACA1C980B5
8 changed files with 13 additions and 20 deletions

8
Cargo.lock generated
View File

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

View File

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

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,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)
};

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

@ -221,7 +221,7 @@ mod test {
println!("h: {:#?}", histdb.histdb);
println!("counter: {:?}", histdb.histdb.len());
for i in histdb.histdb {
println!("{:?}", i);
println!("{i:?}");
}
}
}

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