1
0
Fork 0
mirror of https://git.sr.ht/~spicywolf/k2spice synced 2025-01-18 17:59:39 +00:00

use if let in pwd

This commit is contained in:
Ren Kararou 2023-11-14 11:51:37 -06:00
parent b6a1e4478a
commit 63d31cac78
Signed by: spicywolf
GPG key ID: B0BA4EEC0714F8E6

View file

@ -25,18 +25,15 @@
* Use is subject to license terms. * Use is subject to license terms.
*/ */
use std::process::exit;
use std::env::current_dir; use std::env::current_dir;
use std::process::exit;
fn main() { fn main() {
match current_dir() { if let Ok(buf) = current_dir() {
Ok(buf) => { println!("{}", buf.to_str().expect("pwd: cannot determine current directoy!"));
println!("{}", buf.to_str().unwrap());
exit(0); exit(0);
}, } else {
Err(_) => {
eprintln!("pwd: cannot determine current directory!"); eprintln!("pwd: cannot determine current directory!");
exit(2); exit(2);
},
} }
} }