Fixup Display output to unwrap name
This commit is contained in:
parent
a55f319854
commit
7da53b57fe
2 changed files with 2 additions and 2 deletions
|
@ -9,7 +9,7 @@ fn main() {
|
||||||
} else {
|
} else {
|
||||||
let mut devices = evdev::enumerate().collect::<Vec<_>>();
|
let mut devices = evdev::enumerate().collect::<Vec<_>>();
|
||||||
for (i, d) in devices.iter().enumerate() {
|
for (i, d) in devices.iter().enumerate() {
|
||||||
println!("{}: {:?}", i, d.name());
|
println!("{}: {}", i, d.name().unwrap_or("Unnamed device"));
|
||||||
}
|
}
|
||||||
print!("Select the device [0-{}]: ", devices.len());
|
print!("Select the device [0-{}]: ", devices.len());
|
||||||
let _ = std::io::stdout().flush();
|
let _ = std::io::stdout().flush();
|
||||||
|
|
|
@ -222,7 +222,7 @@ const fn bus_name(x: u16) -> &'static str {
|
||||||
|
|
||||||
impl std::fmt::Display for Device {
|
impl std::fmt::Display for Device {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
writeln!(f, "{:?}", self.name)?;
|
writeln!(f, "{}", self.name.as_deref().unwrap_or("Unnamed device"))?;
|
||||||
writeln!(
|
writeln!(
|
||||||
f,
|
f,
|
||||||
" Driver version: {}.{}.{}",
|
" Driver version: {}.{}.{}",
|
||||||
|
|
Loading…
Reference in a new issue