fix clippy warnings on util and rpc

This commit is contained in:
Trinity Pointard
2021-04-09 02:32:42 +02:00
committed by Alex Auvolat
parent 88925ebe22
commit f05bb111c2
9 changed files with 45 additions and 51 deletions
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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())
}
}
+1
View File
@@ -1,3 +1,4 @@
#![allow(clippy::upper_case_acronyms)]
//! Crate containing common functions and types used in Garage
#[macro_use]
+3 -3
View File
@@ -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,