[pbs-devel] [PATCH backup v3 2/2] api: use if-let pattern for error-only handling

Maximiliano Sandoval m.sandoval at proxmox.com
Tue Feb 13 16:49:53 CET 2024


Fabian Grünbichler <f.gruenbichler at proxmox.com> writes:

>>      async fn getxattr(&self, inode: u64, xattr: &OsStr) -> Result<pxar::format::XAttr, Error> {
>>          // TODO: pxar::Accessor could probably get a more optimized method to fetch a specific
>>          // xattr for an entry...
>>          let xattrs = self.listxattrs(inode).await?;
>> -        for entry in xattrs {
>> -            if entry.name().to_bytes() == xattr.as_bytes() {
>> -                return Ok(entry);
>> -            }
>> +        if xattrs
>> +            .iter()
>> +            .any(|entry| request.add_c_string(entry.name()).is_full())
>> +        {
>> +            return Ok(entry);
>
> but this here is an obvious copy paste error that doesn't even compile!
> please check patches before sending, even if they are supposedly trivial
> style fixes!

My bad, I thought `cargo build` on the root was enough to test this
change. Will sent a vN tomorrow splitting the commits, and fixing this.

--
Maximiliano




More information about the pbs-devel mailing list