cargo fmt

This commit is contained in:
Alexander Weiss 2022-02-08 21:46:30 +01:00
parent 09d58a5782
commit 28401ff025
3 changed files with 8 additions and 5 deletions

View File

@ -24,7 +24,7 @@ pub(super) fn execute(be: &impl ReadBackend, opts: Opts) -> Result<()> {
}
})?;
let index= BoomIndex::from_iter(AllIndexFiles::new(be.clone()).into_iter());
let index = BoomIndex::from_iter(AllIndexFiles::new(be.clone()).into_iter());
let snap = SnapshotFile::from_backend(be, id)?;
for path_node in TreeIterator::from_id(be.clone(), index, snap.tree) {

View File

@ -45,7 +45,7 @@ pub fn execute() -> Result<()> {
let args = Opts::parse();
let be = LocalBackend::new(&args.repository);
let passwd = fs::read_to_string(&args.password_file)?.replace("\n","");
let passwd = fs::read_to_string(&args.password_file)?.replace("\n", "");
let key = repo::find_key_in_backend(&be, &passwd, None)?;
let dbe = DecryptBackend::new(&be, key);

View File

@ -28,8 +28,7 @@ impl KeyFile {
let salt = base64::decode(&self.salt)?;
let mut key = [0; 64];
scrypt::scrypt(passwd.as_ref(), &salt, &params, &mut key)
.expect("output length invalid?");
scrypt::scrypt(passwd.as_ref(), &salt, &params, &mut key).expect("output length invalid?");
Ok(Key::from_slice(&key))
}
@ -93,7 +92,11 @@ impl MasterKey {
/// Find a KeyFile in the backend that fits to the given password and return the contained key
/// If a key hint is given, only this key is tested (recommended for a large number of keys)
pub fn find_key_in_backend<B: ReadBackend>(be: &B, passwd: &impl AsRef<[u8]>, hint: Option<Id>) -> Result<Key> {
pub fn find_key_in_backend<B: ReadBackend>(
be: &B,
passwd: &impl AsRef<[u8]>,
hint: Option<Id>,
) -> Result<Key> {
match hint {
Some(id) => KeyFile::from_backend(be, id)?.key_from_password(passwd),
None => be