Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber committed Mar 30, 2022
1 parent e4bb3b6 commit 698559c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/core/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ impl<'a> Storage for ZipStorage<'a> {
fn load(&self, path: &str) -> Result<Vec<u8>, Error> {
let load_from_archive = |archive: &piz::ZipArchive<'_>, path: &str| {
// FIXME error
let entry = match find_path(&archive, path) {
let entry = match find_path(archive, path) {
Some(entry) => Ok(entry),
None => {
if let Some(subdir) = &self.subdir {
find_path(&archive, subdir.to_owned() + path)
.ok_or_else(|| StorageError::EmptyPathError)
find_path(archive, subdir.to_owned() + path)
.ok_or(StorageError::EmptyPathError)
} else {
Err(StorageError::EmptyPathError)
}
Expand Down Expand Up @@ -255,9 +255,8 @@ impl<'a> ZipStorage<'a> {
Ok(Self {
mapping: Some(mapping),
archive: None,
subdir: subdir,
path: Some(location.to_string()),
//metadata: tree,
subdir, //metadata: tree,
})
}

Expand All @@ -274,11 +273,10 @@ impl<'a> ZipStorage<'a> {
Ok(Self {
archive: Some(archive),
mapping: None,
subdir: subdir,
path: None,
/* metadata: archive
.as_tree()
.map_err(|_| StorageError::EmptyPathError)?, */
subdir, /* metadata: archive
.as_tree()
.map_err(|_| StorageError::EmptyPathError)?, */
})
}

Expand Down Expand Up @@ -311,7 +309,7 @@ impl<'a> ZipStorage<'a> {
};

if let Some(archive) = &self.archive {
sbts_in_archive(&archive)
sbts_in_archive(archive)
} else {
//FIXME
let archive = piz::ZipArchive::new((&self.mapping.as_ref()).unwrap())
Expand All @@ -330,7 +328,7 @@ impl<'a> ZipStorage<'a> {
};

if let Some(archive) = &self.archive {
filenames(&archive)
filenames(archive)
} else {
//FIXME
let archive = piz::ZipArchive::new((&self.mapping.as_ref()).unwrap())
Expand Down

0 comments on commit 698559c

Please sign in to comment.