diff options
author | Ren Kararou <[email protected]> | 2023-11-14 11:51:37 -0600 |
---|---|---|
committer | Ren Kararou <[email protected]> | 2023-11-14 11:51:37 -0600 |
commit | 63d31cac785372a130b9430e93f7cc3a05646ce4 (patch) | |
tree | 6a02f0a91a5000c07bac5dbda5e1c53949e8b2d8 | |
parent | b6a1e4478a907f37053ca0aabb7c691b6d890743 (diff) | |
download | k2spice-63d31cac785372a130b9430e93f7cc3a05646ce4.tar.gz k2spice-63d31cac785372a130b9430e93f7cc3a05646ce4.tar.bz2 k2spice-63d31cac785372a130b9430e93f7cc3a05646ce4.zip |
use if let in pwd
-rw-r--r-- | usr/src/mei/pwd/src/pwd.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/usr/src/mei/pwd/src/pwd.rs b/usr/src/mei/pwd/src/pwd.rs index 051f5bc..b0cc40d 100644 --- a/usr/src/mei/pwd/src/pwd.rs +++ b/usr/src/mei/pwd/src/pwd.rs @@ -25,18 +25,15 @@ * Use is subject to license terms. */ -use std::process::exit; use std::env::current_dir; +use std::process::exit; fn main() { - match current_dir() { - Ok(buf) => { - println!("{}", buf.to_str().unwrap()); - exit(0); - }, - Err(_) => { - eprintln!("pwd: cannot determine current directory!"); - exit(2); - }, + if let Ok(buf) = current_dir() { + println!("{}", buf.to_str().expect("pwd: cannot determine current directoy!")); + exit(0); + } else { + eprintln!("pwd: cannot determine current directory!"); + exit(2); } } |