mirror of
https://git.sr.ht/~spicywolf/k2spice
synced 2025-01-18 09:49:38 +00:00
use if let in pwd
This commit is contained in:
parent
b6a1e4478a
commit
63d31cac78
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue