Bump rust deps

This commit is contained in:
Andras Schmelczer 2025-04-04 21:58:05 +01:00
parent 0e53631cc8
commit 3881f56b45
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
6 changed files with 81 additions and 36 deletions

View file

@ -26,16 +26,16 @@ impl Config {
pub async fn read_or_create(path: &Path) -> Result<Self> {
if path.exists() {
info!(
"Loading configuration from {:?}",
path.canonicalize().unwrap()
"Loading configuration from '{}'",
path.canonicalize().unwrap().display()
);
Self::load_from_file(path).await
} else {
let config = Self::default();
config.write(path).await?;
warn!(
"Configuration file not found, wrote default configuration to {:?}",
path.canonicalize().unwrap()
"Configuration file not found, wrote default configuration to '{}'",
path.canonicalize().unwrap().display()
);
Ok(config)
}

View file

@ -1,4 +1,4 @@
use rand::{Rng as _, distributions::Alphanumeric, thread_rng};
use rand::{Rng, distr::Alphanumeric, rng};
use serde::{Deserialize, Serialize};
use crate::app_state::database::models::VaultId;
@ -53,7 +53,7 @@ fn default_users() -> Vec<User> {
}
pub fn get_random_token() -> String {
thread_rng()
rng()
.sample_iter(&Alphanumeric)
.take(64)
.map(char::from)

View file

@ -105,26 +105,26 @@ pub const fn init_error(error: anyhow::Error) -> SyncServerError {
}
pub fn server_error(error: anyhow::Error) -> SyncServerError {
error!("Server error: {:?}", error);
error!("Server error: {error:?}");
SyncServerError::ServerError(error)
}
pub fn client_error(error: anyhow::Error) -> SyncServerError {
info!("Client error: {:?}", error);
info!("Client error: {error:?}");
SyncServerError::ClientError(error)
}
pub fn not_found_error(error: anyhow::Error) -> SyncServerError {
info!("Not found: {:?}", error);
info!("Not found: {error:?}");
SyncServerError::NotFound(error)
}
pub fn unauthenticated_error(error: anyhow::Error) -> SyncServerError {
info!("Unauthenticated user: {:?}", error);
info!("Unauthenticated user: {error:?}");
SyncServerError::Unauthenticated(error)
}
pub fn permission_denied_error(error: anyhow::Error) -> SyncServerError {
info!("Permission denied: {:?}", error);
info!("Permission denied: {error:?}");
SyncServerError::PermissionDeniedError(error)
}

View file

@ -50,18 +50,15 @@ async fn websocket_wrapped(
vault_id: VaultId,
since_update_id: Option<VaultUpdateId>,
) {
info!("Websocket connection opened on vault '{}'", vault_id);
info!("Websocket connection opened on vault '{vault_id}'");
let result = websocket(state, stream, vault_id.clone(), since_update_id).await;
if let Err(err) = result {
error!(
"Websocket connection error on vault '{}': {}",
vault_id, err
);
error!("Websocket connection error on vault '{vault_id}': {err}");
}
warn!("Websocket connection closed on vault '{}'", vault_id);
warn!("Websocket connection closed on vault '{vault_id}'");
}
async fn websocket(