Simplify create_tar_decoder: Ret io::Result

instead of `Result<Archive, BinstallError>`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-18 17:56:17 +10:00
parent 0480e99460
commit 1161a60968
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -1,5 +1,5 @@
use std::fs::File; use std::fs::File;
use std::io::{BufRead, Read}; use std::io::{self, BufRead, Read};
use std::path::Path; use std::path::Path;
use flate2::bufread::GzDecoder; use flate2::bufread::GzDecoder;
@ -14,7 +14,7 @@ use crate::{BinstallError, TarBasedFmt};
pub(super) fn create_tar_decoder( pub(super) fn create_tar_decoder(
dat: impl BufRead + 'static, dat: impl BufRead + 'static,
fmt: TarBasedFmt, fmt: TarBasedFmt,
) -> Result<Archive<Box<dyn Read>>, BinstallError> { ) -> io::Result<Archive<Box<dyn Read>>> {
use TarBasedFmt::*; use TarBasedFmt::*;
let r: Box<dyn Read> = match fmt { let r: Box<dyn Read> = match fmt {