diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/data.rs | 2 | ||||
-rw-r--r-- | src/util/error.rs | 4 | ||||
-rw-r--r-- | src/util/lib.rs | 1 | ||||
-rw-r--r-- | src/util/persister.rs | 6 |
4 files changed, 7 insertions, 6 deletions
diff --git a/src/util/data.rs b/src/util/data.rs index 34ee8a18..56c7ab56 100644 --- a/src/util/data.rs +++ b/src/util/data.rs @@ -72,7 +72,7 @@ impl FixedBytes32 { &mut self.0[..] } /// Copy to a slice - pub fn to_vec(&self) -> Vec<u8> { + pub fn to_vec(self) -> Vec<u8> { self.0.to_vec() } /// Try building a FixedBytes32 from a slice diff --git a/src/util/error.rs b/src/util/error.rs index 32dccbe6..2b862269 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -93,12 +93,12 @@ impl From<sled::transaction::TransactionError<Error>> for Error { impl<T> From<tokio::sync::watch::error::SendError<T>> for Error { fn from(_e: tokio::sync::watch::error::SendError<T>) -> Error { - Error::Message(format!("Watch send error")) + Error::Message("Watch send error".to_string()) } } impl<T> From<tokio::sync::mpsc::error::SendError<T>> for Error { fn from(_e: tokio::sync::mpsc::error::SendError<T>) -> Error { - Error::Message(format!("MPSC send error")) + Error::Message("MPSC send error".to_string()) } } diff --git a/src/util/lib.rs b/src/util/lib.rs index c080e3a3..15d020cc 100644 --- a/src/util/lib.rs +++ b/src/util/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::upper_case_acronyms)] //! Crate containing common functions and types used in Garage #[macro_use] diff --git a/src/util/persister.rs b/src/util/persister.rs index 93b7cdf4..9e1a1910 100644 --- a/src/util/persister.rs +++ b/src/util/persister.rs @@ -1,5 +1,5 @@ use std::io::{Read, Write}; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; @@ -18,8 +18,8 @@ impl<T> Persister<T> where T: Serialize + for<'de> Deserialize<'de>, { - pub fn new(base_dir: &PathBuf, file_name: &str) -> Self { - let mut path = base_dir.clone(); + pub fn new(base_dir: &Path, file_name: &str) -> Self { + let mut path = base_dir.to_path_buf(); path.push(file_name); Self { path, |