diff options
| author | mat <git@matdoes.dev> | 2025-05-30 19:36:59 -0800 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-05-30 19:36:59 -0800 |
| commit | ae4b1e85e669bc882d158509ef1eda46c6b2a72e (patch) | |
| tree | adf81cc01b0ce1575e95b99ad109fd92db1738f6 /azalea-auth/src/cache.rs | |
| parent | a64c6505049082175224802c5be51ac8f0cf4677 (diff) | |
| download | azalea-drasl-ae4b1e85e669bc882d158509ef1eda46c6b2a72e.tar.xz | |
fix clippy issues and improve formatting everywhere
Diffstat (limited to 'azalea-auth/src/cache.rs')
| -rw-r--r-- | azalea-auth/src/cache.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/azalea-auth/src/cache.rs b/azalea-auth/src/cache.rs index ca32958f..9207c46e 100644 --- a/azalea-auth/src/cache.rs +++ b/azalea-auth/src/cache.rs @@ -1,22 +1,23 @@ //! Cache auth information +use std::io; use std::path::Path; use std::time::{SystemTime, UNIX_EPOCH}; use serde::{Deserialize, Serialize}; use thiserror::Error; -use tokio::fs::File; +use tokio::fs::{self, File}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tracing::{debug, trace}; #[derive(Debug, Error)] pub enum CacheError { #[error("Failed to read cache file: {0}")] - Read(std::io::Error), + Read(io::Error), #[error("Failed to write cache file: {0}")] - Write(std::io::Error), + Write(io::Error), #[error("Failed to create cache file directory: {0}")] - MkDir(std::io::Error), + MkDir(io::Error), #[error("Failed to parse cache file: {0}")] Parse(serde_json::Error), } @@ -94,7 +95,9 @@ async fn set_entire_cache(cache_file: &Path, cache: Vec<CachedAccount>) -> Resul "Making cache file parent directory at {}", cache_file_parent.to_string_lossy() ); - std::fs::create_dir_all(cache_file_parent).map_err(CacheError::MkDir)?; + fs::create_dir_all(cache_file_parent) + .await + .map_err(CacheError::MkDir)?; } let mut cache_file = File::create(cache_file).await.map_err(CacheError::Write)?; let cache = serde_json::to_string_pretty(&cache).map_err(CacheError::Parse)?; |
