about summary refs log tree commit diff
path: root/util/src/fs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'util/src/fs.rs')
-rw-r--r--util/src/fs.rs14
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),
+            },
         }
     }
 }