Rm scopeguard creatd for mpsc::Receiver

Since `Receiver` always closes on drop, there is no need to call
`Receiver::close`, which is there so that you can close the mpsc channel
without dropping `Receiver`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-10 13:52:11 +10:00
parent 29b28a4f8f
commit 1c3a672108
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -37,14 +37,9 @@ impl AsyncExtracterInner {
desired_outputs: Option<[Cow<'static, Path>; N]>,
) -> Self {
let path = path.to_owned();
let (tx, rx) = mpsc::channel::<Content>(100);
let (tx, mut rx) = mpsc::channel::<Content>(100);
let handle = AutoAbortJoinHandle::new(spawn_blocking(move || {
// close rx on error so that tx.send will return an error
let mut rx = guard(rx, |mut rx| {
rx.close();
});
fs::create_dir_all(path.parent().unwrap())?;
match fmt {