Fix clippy::unnecessary::filter-map warning
This commit is contained in:
parent
a774d8c52e
commit
a5cd2978b3
|
@ -176,22 +176,19 @@ pub fn primary_gpu<S: AsRef<str>>(seat: S) -> IoResult<Option<PathBuf>> {
|
||||||
|
|
||||||
if let Some(path) = enumerator
|
if let Some(path) = enumerator
|
||||||
.scan_devices()?
|
.scan_devices()?
|
||||||
.filter_map(|device| {
|
.filter(|device| {
|
||||||
if device
|
let seat_name = device
|
||||||
.property_value("ID_SEAT")
|
.property_value("ID_SEAT")
|
||||||
.map(|x| x.to_os_string())
|
.map(|x| x.to_os_string())
|
||||||
.unwrap_or_else(|| OsString::from("seat0"))
|
.unwrap_or_else(|| OsString::from("seat0"));
|
||||||
== *seat.as_ref()
|
if seat_name == *seat.as_ref() {
|
||||||
{
|
|
||||||
if let Ok(Some(pci)) = device.parent_with_subsystem(Path::new("pci")) {
|
if let Ok(Some(pci)) = device.parent_with_subsystem(Path::new("pci")) {
|
||||||
if let Some(id) = pci.attribute_value("boot_vga") {
|
if let Some(id) = pci.attribute_value("boot_vga") {
|
||||||
if id == "1" {
|
return id == "1";
|
||||||
return Some(device);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
false
|
||||||
None
|
|
||||||
})
|
})
|
||||||
.flat_map(|device| device.devnode().map(PathBuf::from))
|
.flat_map(|device| device.devnode().map(PathBuf::from))
|
||||||
.next()
|
.next()
|
||||||
|
|
Loading…
Reference in New Issue