chore: update rust toolchain to 1.85 (#2618)

* chore: update rust toolchain to 1.85

* nix things

* make clippy happy

I've replaced a bunch of &Option<String> with Option<String>.

They were not in hot loops, so a single clone is really no big deal +
keeps things simpler.

* fmt
This commit is contained in:
Ellie Huxtable
2025-03-09 22:27:38 +00:00
committed by GitHub
parent a24e7571e9
commit 231d87c47e
11 changed files with 24 additions and 21 deletions

View File

@@ -7,7 +7,7 @@ exclude = ["ui/backend"]
[workspace.package] [workspace.package]
version = "18.4.0" version = "18.4.0"
authors = ["Ellie Huxtable <ellie@atuin.sh>"] authors = ["Ellie Huxtable <ellie@atuin.sh>"]
rust-version = "1.82" rust-version = "1.85"
license = "MIT" license = "MIT"
homepage = "https://atuin.sh" homepage = "https://atuin.sh"
repository = "https://github.com/atuinsh/atuin" repository = "https://github.com/atuinsh/atuin"

View File

@@ -146,7 +146,7 @@ pub trait Escapable: AsRef<str> {
} else { } else {
let mut remaining = self.as_ref(); let mut remaining = self.as_ref();
// Not a perfect way to reserve space but should reduce the allocations // Not a perfect way to reserve space but should reduce the allocations
let mut buf = String::with_capacity(remaining.as_bytes().len()); let mut buf = String::with_capacity(remaining.len());
while let Some(i) = remaining.find(|c: char| c.is_ascii_control()) { while let Some(i) = remaining.find(|c: char| c.is_ascii_control()) {
// safe to index with `..i`, `i` and `i+1..` as part[i] is a single byte ascii char // safe to index with `..i`, `i` and `i+1..` as part[i] is a single byte ascii char
buf.push_str(&remaining[..i]); buf.push_str(&remaining[..i]);

View File

@@ -33,7 +33,7 @@ pub async fn index<DB: Database>(state: State<AppState<DB>>) -> Json<IndexRespon
}) })
} }
impl<'a> IntoResponse for ErrorResponseStatus<'a> { impl IntoResponse for ErrorResponseStatus<'_> {
fn into_response(self) -> axum::response::Response { fn into_response(self) -> axum::response::Response {
(self.status, Json(self.error)).into_response() (self.status, Json(self.error)).into_response()
} }
@@ -57,7 +57,7 @@ impl<'a> RespExt<'a> for ErrorResponse<'a> {
} }
} }
fn reply(reason: &'a str) -> ErrorResponse { fn reply(reason: &'a str) -> ErrorResponse<'a> {
Self { Self {
reason: reason.into(), reason: reason.into(),
} }

View File

@@ -15,14 +15,14 @@ pub struct Cmd {
impl Cmd { impl Cmd {
pub async fn run(self, settings: &Settings) -> Result<()> { pub async fn run(self, settings: &Settings) -> Result<()> {
run(settings, &self.current_password, &self.new_password).await run(settings, self.current_password, self.new_password).await
} }
} }
pub async fn run( pub async fn run(
settings: &Settings, settings: &Settings,
current_password: &Option<String>, current_password: Option<String>,
new_password: &Option<String>, new_password: Option<String>,
) -> Result<()> { ) -> Result<()> {
let client = api_client::Client::new( let client = api_client::Client::new(
&settings.sync_address, &settings.sync_address,

View File

@@ -49,7 +49,7 @@ impl Cmd {
return Ok(()); return Ok(());
} }
let username = or_user_input(&self.username, "username"); let username = or_user_input(self.username.clone(), "username");
let password = self.password.clone().unwrap_or_else(read_user_password); let password = self.password.clone().unwrap_or_else(read_user_password);
let key_path = settings.key_path.as_str(); let key_path = settings.key_path.as_str();
@@ -61,7 +61,10 @@ impl Cmd {
println!("Do not share this key with anyone"); println!("Do not share this key with anyone");
println!("\nRead more here: https://docs.atuin.sh/guide/sync/#login \n"); println!("\nRead more here: https://docs.atuin.sh/guide/sync/#login \n");
let key = or_user_input(&self.key, "encryption key [blank to use existing key file]"); let key = or_user_input(
self.key.clone(),
"encryption key [blank to use existing key file]",
);
// if provided, the key may be EITHER base64, or a bip mnemonic // if provided, the key may be EITHER base64, or a bip mnemonic
// try to normalize on base64 // try to normalize on base64
@@ -152,8 +155,8 @@ impl Cmd {
} }
} }
pub(super) fn or_user_input(value: &'_ Option<String>, name: &'static str) -> String { pub(super) fn or_user_input(value: Option<String>, name: &'static str) -> String {
value.clone().unwrap_or_else(|| read_user_input(name)) value.unwrap_or_else(|| read_user_input(name))
} }
pub(super) fn read_user_password() -> String { pub(super) fn read_user_password() -> String {

View File

@@ -18,15 +18,15 @@ pub struct Cmd {
impl Cmd { impl Cmd {
pub async fn run(self, settings: &Settings) -> Result<()> { pub async fn run(self, settings: &Settings) -> Result<()> {
run(settings, &self.username, &self.email, &self.password).await run(settings, self.username, self.email, self.password).await
} }
} }
pub async fn run( pub async fn run(
settings: &Settings, settings: &Settings,
username: &Option<String>, username: Option<String>,
email: &Option<String>, email: Option<String>,
password: &Option<String>, password: Option<String>,
) -> Result<()> { ) -> Result<()> {
use super::login::or_user_input; use super::login::or_user_input;
println!("Registering for an Atuin Sync account"); println!("Registering for an Atuin Sync account");

View File

@@ -145,7 +145,7 @@ impl<'db, DB: Database> HistoryImporter<'db, DB> {
} }
#[async_trait] #[async_trait]
impl<'db, DB: Database> Loader for HistoryImporter<'db, DB> { impl<DB: Database> Loader for HistoryImporter<'_, DB> {
async fn push(&mut self, hist: History) -> Result<()> { async fn push(&mut self, hist: History) -> Result<()> {
self.pb.inc(1); self.pb.inc(1);
self.buf.push(hist); self.buf.push(hist);

View File

@@ -48,7 +48,7 @@ impl ListState {
} }
} }
impl<'a> StatefulWidget for HistoryList<'a> { impl StatefulWidget for HistoryList<'_> {
type State = ListState; type State = ListState;
fn render(mut self, area: Rect, buf: &mut Buffer, state: &mut Self::State) { fn render(mut self, area: Rect, buf: &mut Buffer, state: &mut Self::State) {

View File

@@ -7,8 +7,8 @@ use atuin_client::{
}; };
use atuin_common::record::RecordId; use atuin_common::record::RecordId;
/// This is the only crate that ties together all other crates. // This is the only crate that ties together all other crates.
/// Therefore, it's the only crate where functions tying together all stores can live // Therefore, it's the only crate where functions tying together all stores can live
/// Rebuild all stores after a sync /// Rebuild all stores after a sync
/// Note: for history, this only does an _incremental_ sync. Hence the need to specify downloaded /// Note: for history, this only does an _incremental_ sync. Hence the need to specify downloaded

View File

@@ -32,7 +32,7 @@
fenix.packages.${system}.fromToolchainFile fenix.packages.${system}.fromToolchainFile
{ {
file = ./rust-toolchain.toml; file = ./rust-toolchain.toml;
sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk="; sha256 = "sha256-AJ6LX/Q/Er9kS15bn9iflkUwcgYqRQxiOIL2ToVAXaU=";
}; };
in in
pkgs.makeRustPlatform { pkgs.makeRustPlatform {

View File

@@ -1,2 +1,2 @@
[toolchain] [toolchain]
channel = "1.82" channel = "1.85"