clippy: Fix clippy::unnecessary_map_or

Fix `clippy::unnecessary_map_or` warnings reported by clippy 0.1.85
(4d91de4e48 2025-02-17).

```console
error: this `map_or` can be simplified
   --> vhost-device-scsi/src/virtio.rs:182:15
    |
182 |           while self
    |  _______________^
183 | |             .current
184 | |             .map_or(false, |current| self.offset >= current.len())
    | |__________________________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
    = note: `-D clippy::unnecessary-map-or` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_or)]`
help: use is_some_and instead
    |
182 ~         while self
183 +             .current.is_some_and(|current| self.offset >= current.len())
    |
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
Ruoqing He 2025-03-31 13:54:38 +08:00 committed by Stefano Garzarella
parent e4c5eb90e7
commit 7cc433f50f

View File

@ -181,7 +181,7 @@ where
self.add_written(bytes);
while self
.current
.map_or(false, |current| self.offset >= current.len())
.is_some_and(|current| self.offset >= current.len())
{
let current = self.current.expect("loop condition ensures existance");
self.offset -= current.len();