FIX 9919c72: add doc comment, remove accidentally doubled is_archive()

This commit is contained in:
Anton Hermann 2021-11-01 12:40:30 +01:00
parent 9919c72347
commit 8527616729
3 changed files with 3 additions and 6 deletions

View File

@ -44,6 +44,8 @@ pub fn unpack_archive(
Ok(files_unpacked) Ok(files_unpacked)
} }
/// List contents of `archive`, returning a vector of archive entries
pub fn list_archive(reader: Box<dyn Read>) -> crate::Result<Vec<FileInArchive>> { pub fn list_archive(reader: Box<dyn Read>) -> crate::Result<Vec<FileInArchive>> {
let mut archive = tar::Archive::new(reader); let mut archive = tar::Archive::new(reader);

View File

@ -192,7 +192,7 @@ pub fn run(args: Opts, question_policy: QuestionPolicy) -> crate::Result<()> {
let not_archives: Vec<PathBuf> = files let not_archives: Vec<PathBuf> = files
.iter() .iter()
.zip(&formats) .zip(&formats)
.filter(|(_, formats)| formats.is_empty() || !formats[0].is_archive()) .filter(|(_, formats)| formats.is_empty() || !formats[0].is_archive_format())
.map(|(path, _)| path.clone()) .map(|(path, _)| path.clone())
.collect(); .collect();

View File

@ -47,11 +47,6 @@ impl fmt::Display for CompressionFormat {
) )
} }
} }
impl CompressionFormat {
pub fn is_archive(&self) -> bool {
matches!(self, Tar | Tgz | Tbz | Tlzma | Tzst | Zip)
}
}
// use crate::extension::CompressionFormat::*; // use crate::extension::CompressionFormat::*;
// //