remove (clippy) warnings

This commit is contained in:
Alexander Weiss 2022-02-07 17:27:18 +01:00
parent ecfbbcf4ac
commit 7874205e8e
5 changed files with 15 additions and 17 deletions

View File

@ -25,7 +25,7 @@ impl<R: ReadBackend> DecryptBackend<R> {
pub fn new(be: &R, key: Key) -> Self {
Self {
backend: be.clone(),
key: key,
key,
}
}
}
@ -38,15 +38,13 @@ impl<R: ReadBackend> ReadBackend for DecryptBackend<R> {
}
fn list(&self, tpe: FileType) -> Result<Vec<Id>, 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<Vec<u8>, 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<R: ReadBackend> ReadBackend for DecryptBackend<R> {
) -> Result<Vec<u8>, Self::Error> {
self.key
.decrypt_data(&self.backend.read_partial(tpe, id, offset, length)?)
.map_err(|err| RepoError::CryptoError(err))
.map_err(RepoError::CryptoError)
}
}

View File

@ -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() {

View File

@ -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)]

View File

@ -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)
}
}

View File

@ -10,7 +10,7 @@ pub struct AllIndexFiles<BE> {
impl<BE: ReadBackend> AllIndexFiles<BE> {
pub fn new(be: BE) -> Self {
Self { be: be }
Self { be }
}
}
@ -26,7 +26,7 @@ impl<BE: ReadBackend> AllIndexFiles<BE> {
.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()))