mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2025-12-29 17:09:25 +00:00
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:
parent
e4c5eb90e7
commit
7cc433f50f
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user