mirror of
https://github.com/atuinsh/atuin.git
synced 2025-08-19 11:20:13 +02:00
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:
@@ -7,7 +7,7 @@ exclude = ["ui/backend"]
|
||||
[workspace.package]
|
||||
version = "18.4.0"
|
||||
authors = ["Ellie Huxtable <ellie@atuin.sh>"]
|
||||
rust-version = "1.82"
|
||||
rust-version = "1.85"
|
||||
license = "MIT"
|
||||
homepage = "https://atuin.sh"
|
||||
repository = "https://github.com/atuinsh/atuin"
|
||||
|
@@ -146,7 +146,7 @@ pub trait Escapable: AsRef<str> {
|
||||
} else {
|
||||
let mut remaining = self.as_ref();
|
||||
// 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()) {
|
||||
// safe to index with `..i`, `i` and `i+1..` as part[i] is a single byte ascii char
|
||||
buf.push_str(&remaining[..i]);
|
||||
|
@@ -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 {
|
||||
(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 {
|
||||
reason: reason.into(),
|
||||
}
|
||||
|
@@ -15,14 +15,14 @@ pub struct Cmd {
|
||||
|
||||
impl Cmd {
|
||||
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(
|
||||
settings: &Settings,
|
||||
current_password: &Option<String>,
|
||||
new_password: &Option<String>,
|
||||
current_password: Option<String>,
|
||||
new_password: Option<String>,
|
||||
) -> Result<()> {
|
||||
let client = api_client::Client::new(
|
||||
&settings.sync_address,
|
||||
|
@@ -49,7 +49,7 @@ impl Cmd {
|
||||
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 key_path = settings.key_path.as_str();
|
||||
@@ -61,7 +61,10 @@ impl Cmd {
|
||||
println!("Do not share this key with anyone");
|
||||
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
|
||||
// try to normalize on base64
|
||||
@@ -152,8 +155,8 @@ impl Cmd {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn or_user_input(value: &'_ Option<String>, name: &'static str) -> String {
|
||||
value.clone().unwrap_or_else(|| read_user_input(name))
|
||||
pub(super) fn or_user_input(value: Option<String>, name: &'static str) -> String {
|
||||
value.unwrap_or_else(|| read_user_input(name))
|
||||
}
|
||||
|
||||
pub(super) fn read_user_password() -> String {
|
||||
|
@@ -18,15 +18,15 @@ pub struct Cmd {
|
||||
|
||||
impl Cmd {
|
||||
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(
|
||||
settings: &Settings,
|
||||
username: &Option<String>,
|
||||
email: &Option<String>,
|
||||
password: &Option<String>,
|
||||
username: Option<String>,
|
||||
email: Option<String>,
|
||||
password: Option<String>,
|
||||
) -> Result<()> {
|
||||
use super::login::or_user_input;
|
||||
println!("Registering for an Atuin Sync account");
|
||||
|
@@ -145,7 +145,7 @@ impl<'db, DB: Database> HistoryImporter<'db, DB> {
|
||||
}
|
||||
|
||||
#[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<()> {
|
||||
self.pb.inc(1);
|
||||
self.buf.push(hist);
|
||||
|
@@ -48,7 +48,7 @@ impl ListState {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StatefulWidget for HistoryList<'a> {
|
||||
impl StatefulWidget for HistoryList<'_> {
|
||||
type State = ListState;
|
||||
|
||||
fn render(mut self, area: Rect, buf: &mut Buffer, state: &mut Self::State) {
|
||||
|
@@ -7,8 +7,8 @@ use atuin_client::{
|
||||
};
|
||||
use atuin_common::record::RecordId;
|
||||
|
||||
/// 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
|
||||
// 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
|
||||
|
||||
/// Rebuild all stores after a sync
|
||||
/// Note: for history, this only does an _incremental_ sync. Hence the need to specify downloaded
|
||||
|
@@ -32,7 +32,7 @@
|
||||
fenix.packages.${system}.fromToolchainFile
|
||||
{
|
||||
file = ./rust-toolchain.toml;
|
||||
sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk=";
|
||||
sha256 = "sha256-AJ6LX/Q/Er9kS15bn9iflkUwcgYqRQxiOIL2ToVAXaU=";
|
||||
};
|
||||
in
|
||||
pkgs.makeRustPlatform {
|
||||
|
@@ -1,2 +1,2 @@
|
||||
[toolchain]
|
||||
channel = "1.82"
|
||||
channel = "1.85"
|
||||
|
Reference in New Issue
Block a user