diff options
author | Vika <vika@fireburn.ru> | 2025-04-09 23:31:02 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2025-04-09 23:31:57 +0300 |
commit | 8826d9446e6c492db2243b9921e59ce496027bef (patch) | |
tree | 63738aa9001cb73b11cb0e974e93129bcdf1adbb /util/src/fs.rs | |
parent | 519cadfbb298f50cbf819dde757037ab56e2863e (diff) | |
download | kittybox-8826d9446e6c492db2243b9921e59ce496027bef.tar.zst |
cargo fmt
Change-Id: I80e81ebba3f0cdf8c094451c9fe3ee4126b8c888
Diffstat (limited to 'util/src/fs.rs')
-rw-r--r-- | util/src/fs.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/util/src/fs.rs b/util/src/fs.rs index 6a7a5b4..ea9dadd 100644 --- a/util/src/fs.rs +++ b/util/src/fs.rs @@ -1,6 +1,6 @@ +use rand::{distributions::Alphanumeric, Rng}; use std::io::{self, Result}; use std::path::{Path, PathBuf}; -use rand::{Rng, distributions::Alphanumeric}; use tokio::fs; /// Create a temporary file named `temp.[a-zA-Z0-9]{length}` in @@ -20,7 +20,7 @@ use tokio::fs; pub async fn mktemp<T, B>(dir: T, basename: B, length: usize) -> Result<(PathBuf, fs::File)> where T: AsRef<Path>, - B: Into<Option<&'static str>> + B: Into<Option<&'static str>>, { let dir = dir.as_ref(); let basename = basename.into().unwrap_or(""); @@ -33,9 +33,9 @@ where if basename.is_empty() { "" } else { "." }, { let string = rand::thread_rng() - .sample_iter(&Alphanumeric) - .take(length) - .collect::<Vec<u8>>(); + .sample_iter(&Alphanumeric) + .take(length) + .collect::<Vec<u8>>(); String::from_utf8(string).unwrap() } )); @@ -49,8 +49,8 @@ where Ok(file) => return Ok((filename, file)), Err(err) => match err.kind() { io::ErrorKind::AlreadyExists => continue, - _ => return Err(err) - } + _ => return Err(err), + }, } } } |