[pbs-devel] [PATCH proxmox-backup 4/4] pxar: use anyhow::Error in PxarBackupStream

Gabriel Goller g.goller at proxmox.com
Mon Feb 19 11:53:48 CET 2024


On Fri Feb 16, 2024 at 6:47 PM CET, Max Carrara wrote:
> On 2/16/24 16:33, Gabriel Goller wrote:
> > +            let mut error = self.error.lock().unwrap();
> > +            if error.is_some() {
> > +                let err = error.take().unwrap();
> > +                return Poll::Ready(Some(Err(err)));
> >              }
>
> ... could be replaced with the following:
>
>     let mut error = self.error.lock().unwrap();
>     if let Some(err) = error.take() {
>         return Poll::Ready(Some(Err(err)));
>     }
>
> `Option::take()` also returns an `Option`, allowing you to omit the `unwrap()`.

Good point!
Will be fixed in the next version!





More information about the pbs-devel mailing list