diff --git a/src/backend/decrypt.rs b/src/backend/decrypt.rs index dcf5eca..4bf0c35 100644 --- a/src/backend/decrypt.rs +++ b/src/backend/decrypt.rs @@ -25,7 +25,7 @@ impl DecryptBackend { pub fn new(be: &R, key: Key) -> Self { Self { backend: be.clone(), - key: key, + key, } } } @@ -38,15 +38,13 @@ impl ReadBackend for DecryptBackend { } fn list(&self, tpe: FileType) -> Result, Self::Error> { - self.backend - .list(tpe) - .map_err(|err| RepoError::RepoError(err)) + self.backend.list(tpe).map_err(RepoError::RepoError) } fn read_full(&self, tpe: FileType, id: Id) -> Result, Self::Error> { self.key .decrypt_data(&self.backend.read_full(tpe, id)?) - .map_err(|err| RepoError::CryptoError(err)) + .map_err(RepoError::CryptoError) } fn read_partial( @@ -58,6 +56,6 @@ impl ReadBackend for DecryptBackend { ) -> Result, Self::Error> { self.key .decrypt_data(&self.backend.read_partial(tpe, id, offset, length)?) - .map_err(|err| RepoError::CryptoError(err)) + .map_err(RepoError::CryptoError) } } diff --git a/src/blob/tree.rs b/src/blob/tree.rs index 9eb47a5..e1d77f4 100644 --- a/src/blob/tree.rs +++ b/src/blob/tree.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use anyhow::{anyhow, Result}; use chrono::{DateTime, Local}; -use derive_more::{Constructor, Display}; +use derive_more::Constructor; use serde::{Deserialize, Serialize}; use serde_aux::prelude::*; @@ -96,8 +96,8 @@ where .unwrap() .nodes .into_iter(), - be: be, - index: index, + be, + index, open_iterators: Vec::new(), path: PathBuf::new(), } @@ -135,7 +135,7 @@ where } else { self.path.join(&node.name) }, - node: node, + node, }); } None => match self.open_iterators.pop() { diff --git a/src/commands/ls.rs b/src/commands/ls.rs index f3bd787..dd56483 100644 --- a/src/commands/ls.rs +++ b/src/commands/ls.rs @@ -1,10 +1,10 @@ -use anyhow::{anyhow, bail, Result}; +use anyhow::{anyhow, Result}; use clap::Parser; use crate::backend::{FileType, MapResult, ReadBackend}; -use crate::blob::{Tree, TreeIterator}; +use crate::blob::TreeIterator; use crate::id::Id; -use crate::index::{indexfiles::AllIndexFiles, ReadIndex}; +use crate::index::indexfiles::AllIndexFiles; use crate::repo::SnapshotFile; #[derive(Parser)] diff --git a/src/id.rs b/src/id.rs index 5498bd5..9db7fce 100644 --- a/src/id.rs +++ b/src/id.rs @@ -30,7 +30,7 @@ impl Id { )) } - pub fn to_hex(&self) -> String { - hex::encode(&self.0) + pub fn to_hex(self) -> String { + hex::encode(self.0) } } diff --git a/src/index/indexfiles.rs b/src/index/indexfiles.rs index 4b3673f..bfc82c9 100644 --- a/src/index/indexfiles.rs +++ b/src/index/indexfiles.rs @@ -10,7 +10,7 @@ pub struct AllIndexFiles { impl AllIndexFiles { pub fn new(be: BE) -> Self { - Self { be: be } + Self { be } } } @@ -26,7 +26,7 @@ impl AllIndexFiles { .packs() .into_iter() .flat_map(|p| { - let id = p.id().clone(); + let id = *p.id(); p.blobs() .into_iter() .map(move |b| IndexEntry::new(id, b.to_bi()))