summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2019-09-15 14:56:39 +0200
committerAram Drevekenin <aram@poor.dev>2019-09-15 14:56:39 +0200
commit66a5839e732e835324097cc0cb72399bfcd6c68a (patch)
tree68bc1c9a513a6aad866d362986040e597d1d3f49
parentd2dc6c5e9c104347d1a547f686548ed69fa051e3 (diff)
refactor(linux): style and less cloning
-rw-r--r--src/os/linux.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/os/linux.rs b/src/os/linux.rs
index 1fb5397..f6314b4 100644
--- a/src/os/linux.rs
+++ b/src/os/linux.rs
@@ -16,13 +16,8 @@ impl Iterator for KeyboardEvents {
let stdin = stdin();
let mut events = stdin.events(); // TODO: not every time?
match events.next() {
- Some(res) => {
- match res {
- Ok(ev) => Some(ev),
- Err(_) => None
- }
- },
- None => None
+ Some(Ok(ev)) => Some(ev),
+ _ => None
}
}
}
@@ -50,7 +45,7 @@ pub fn get_interface () -> NetworkInterface {
pub fn get_process_name (id: i32) -> Option<String> {
match Process::new(id) {
- Ok(process) => Some(process.stat.comm.to_string()),
+ Ok(process) => Some(process.stat.comm),
Err(_) => None
}
}