mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 13:08:42 +00:00
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:
parent
29b28a4f8f
commit
1c3a672108
1 changed files with 1 additions and 6 deletions
|
@ -37,14 +37,9 @@ impl AsyncExtracterInner {
|
||||||
desired_outputs: Option<[Cow<'static, Path>; N]>,
|
desired_outputs: Option<[Cow<'static, Path>; N]>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let path = path.to_owned();
|
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 || {
|
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())?;
|
fs::create_dir_all(path.parent().unwrap())?;
|
||||||
|
|
||||||
match fmt {
|
match fmt {
|
||||||
|
|
Loading…
Add table
Reference in a new issue