Skip to content

Commit 973ba89

Browse files
author
cht
committed
use unwrap_else
1 parent 13a5e29 commit 973ba89

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/utils.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use std::{
66
io::{prelude::*, Result},
77
path::Path,
88
};
9-
#[allow(dead_code)]
109
pub enum Save {
1110
Storage,
1211
Running,
@@ -47,9 +46,7 @@ pub fn start_v2core() -> String {
4746
Ok(output) => output,
4847
Err(_) => {
4948
let core = "{\n\"v2core\":\"/usr/bin/v2ray\"\n}".to_string();
50-
if let Err(err) = create_json_file(Save::V2ray, core.clone()) {
51-
panic!("{}", err);
52-
}
49+
create_json_file(Save::V2ray, core.clone()).unwrap_or_else(|err| panic!("{}", err));
5350
core
5451
}
5552
};

0 commit comments

Comments
 (0)