Skip to content

Commit

Permalink
clippy 1.84.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tuna-f1sh committed Jan 22, 2025
1 parent 87bf42f commit 4f2392e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/filter_devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() -> Result<(), String> {
filter.retain_buses(&mut sp_usb.buses);
sp_usb
.buses
.retain(|b| b.devices.as_ref().map_or(false, |d| d.is_empty()));
.retain(|b| b.devices.as_ref().is_some_and(|d| d.is_empty()));

// if one does not care about the tree, flatten the devices and do manually
// let hid_devices = sp_usb.flatten_devices().iter().filter(|d| d.class == Some(BaseClass::HID));
Expand Down
4 changes: 2 additions & 2 deletions src/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ impl IconTheme {
.iter()
.find(|(k, _)| {
if let Icon::Name(s) = k {
regex::Regex::new(s).map_or(false, |r| r.is_match(name))
regex::Regex::new(s).is_ok_and(|r| r.is_match(name))
} else {
false
}
Expand All @@ -490,7 +490,7 @@ impl IconTheme {
.iter()
.find(|(k, _)| {
if let Icon::Name(s) = k {
regex::Regex::new(s).map_or(false, |r| r.is_match(name))
regex::Regex::new(s).is_ok_and(|r| r.is_match(name))
} else {
false
}
Expand Down
2 changes: 1 addition & 1 deletion src/lsusb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ pub fn print(devices: &Vec<&Device>, verbose: bool) {
dump_device_status(
status,
otg.is_some(),
device.bcd_usb.map_or(false, |v| v.major() >= 3),
device.bcd_usb.is_some_and(|v| v.major() >= 3),
0,
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/profiler/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ impl Device {
/// ```
pub fn is_hub(&self) -> bool {
self.name.to_lowercase().contains("hub")
|| self.class.as_ref().map_or(false, |c| *c == BaseClass::Hub)
|| self.class.as_ref().is_some_and(|c| *c == BaseClass::Hub)
}

/// Linux style port path where it can be found on system device path - normally /sys/bus/usb/devices
Expand Down Expand Up @@ -1485,10 +1485,10 @@ impl Filter {
device
.serial_num
.as_ref()
.map_or(false, |s| s.contains(n.as_str()))
.is_some_and(|s| s.contains(n.as_str()))
}))
&& (self.class.as_ref().map_or(true, |fc| {
device.class.as_ref().map_or(false, |c| c == fc) || device.has_interface_class(fc)
device.class.as_ref() == Some(fc) || device.has_interface_class(fc)
}))
&& !(self.exclude_empty_hub && device.is_hub() && !device.has_devices())
&& (!device.is_root_hub() || self.no_exclude_root_hub)
Expand Down

0 comments on commit 4f2392e

Please sign in to comment.