Skip to content

Commit 231d87c

Browse files
authored
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
1 parent a24e757 commit 231d87c

File tree

11 files changed

+24
-21
lines changed

11 files changed

+24
-21
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exclude = ["ui/backend"]
77
[workspace.package]
88
version = "18.4.0"
99
authors = ["Ellie Huxtable <[email protected]>"]
10-
rust-version = "1.82"
10+
rust-version = "1.85"
1111
license = "MIT"
1212
homepage = "https://atuin.sh"
1313
repository = "https://github.com/atuinsh/atuin"

crates/atuin-common/src/utils.rs

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

crates/atuin-server/src/handlers/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub async fn index<DB: Database>(state: State<AppState<DB>>) -> Json<IndexRespon
3333
})
3434
}
3535

36-
impl<'a> IntoResponse for ErrorResponseStatus<'a> {
36+
impl IntoResponse for ErrorResponseStatus<'_> {
3737
fn into_response(self) -> axum::response::Response {
3838
(self.status, Json(self.error)).into_response()
3939
}
@@ -57,7 +57,7 @@ impl<'a> RespExt<'a> for ErrorResponse<'a> {
5757
}
5858
}
5959

60-
fn reply(reason: &'a str) -> ErrorResponse {
60+
fn reply(reason: &'a str) -> ErrorResponse<'a> {
6161
Self {
6262
reason: reason.into(),
6363
}

crates/atuin/src/command/client/account/change_password.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ pub struct Cmd {
1515

1616
impl Cmd {
1717
pub async fn run(self, settings: &Settings) -> Result<()> {
18-
run(settings, &self.current_password, &self.new_password).await
18+
run(settings, self.current_password, self.new_password).await
1919
}
2020
}
2121

2222
pub async fn run(
2323
settings: &Settings,
24-
current_password: &Option<String>,
25-
new_password: &Option<String>,
24+
current_password: Option<String>,
25+
new_password: Option<String>,
2626
) -> Result<()> {
2727
let client = api_client::Client::new(
2828
&settings.sync_address,

crates/atuin/src/command/client/account/login.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl Cmd {
4949
return Ok(());
5050
}
5151

52-
let username = or_user_input(&self.username, "username");
52+
let username = or_user_input(self.username.clone(), "username");
5353
let password = self.password.clone().unwrap_or_else(read_user_password);
5454

5555
let key_path = settings.key_path.as_str();
@@ -61,7 +61,10 @@ impl Cmd {
6161
println!("Do not share this key with anyone");
6262
println!("\nRead more here: https://docs.atuin.sh/guide/sync/#login \n");
6363

64-
let key = or_user_input(&self.key, "encryption key [blank to use existing key file]");
64+
let key = or_user_input(
65+
self.key.clone(),
66+
"encryption key [blank to use existing key file]",
67+
);
6568

6669
// if provided, the key may be EITHER base64, or a bip mnemonic
6770
// try to normalize on base64
@@ -152,8 +155,8 @@ impl Cmd {
152155
}
153156
}
154157

155-
pub(super) fn or_user_input(value: &'_ Option<String>, name: &'static str) -> String {
156-
value.clone().unwrap_or_else(|| read_user_input(name))
158+
pub(super) fn or_user_input(value: Option<String>, name: &'static str) -> String {
159+
value.unwrap_or_else(|| read_user_input(name))
157160
}
158161

159162
pub(super) fn read_user_password() -> String {

crates/atuin/src/command/client/account/register.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ pub struct Cmd {
1818

1919
impl Cmd {
2020
pub async fn run(self, settings: &Settings) -> Result<()> {
21-
run(settings, &self.username, &self.email, &self.password).await
21+
run(settings, self.username, self.email, self.password).await
2222
}
2323
}
2424

2525
pub async fn run(
2626
settings: &Settings,
27-
username: &Option<String>,
28-
email: &Option<String>,
29-
password: &Option<String>,
27+
username: Option<String>,
28+
email: Option<String>,
29+
password: Option<String>,
3030
) -> Result<()> {
3131
use super::login::or_user_input;
3232
println!("Registering for an Atuin Sync account");

crates/atuin/src/command/client/import.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'db, DB: Database> HistoryImporter<'db, DB> {
145145
}
146146

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

crates/atuin/src/command/client/search/history_list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl ListState {
4848
}
4949
}
5050

51-
impl<'a> StatefulWidget for HistoryList<'a> {
51+
impl StatefulWidget for HistoryList<'_> {
5252
type State = ListState;
5353

5454
fn render(mut self, area: Rect, buf: &mut Buffer, state: &mut Self::State) {

crates/atuin/src/sync.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use atuin_client::{
77
};
88
use atuin_common::record::RecordId;
99

10-
/// This is the only crate that ties together all other crates.
11-
/// Therefore, it's the only crate where functions tying together all stores can live
10+
// This is the only crate that ties together all other crates.
11+
// Therefore, it's the only crate where functions tying together all stores can live
1212

1313
/// Rebuild all stores after a sync
1414
/// Note: for history, this only does an _incremental_ sync. Hence the need to specify downloaded

flake.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
fenix.packages.${system}.fromToolchainFile
3333
{
3434
file = ./rust-toolchain.toml;
35-
sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk=";
35+
sha256 = "sha256-AJ6LX/Q/Er9kS15bn9iflkUwcgYqRQxiOIL2ToVAXaU=";
3636
};
3737
in
3838
pkgs.makeRustPlatform {

rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "1.82"
2+
channel = "1.85"

0 commit comments

Comments
 (0)