File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,14 @@ struct UpdateStats {
37
37
bytes_downloaded : u64 ,
38
38
}
39
39
40
- fn parse_info ( info : & str ) -> CdnInfo {
41
- DeJson :: deserialize_json ( info) . unwrap ( )
42
- }
43
-
44
40
// Read file to serde json CdnInfo
45
41
fn read_info_file ( filepath : & Path ) -> CdnInfo {
46
42
let info_file = fs:: read_to_string ( filepath)
47
43
. unwrap_or_else ( |_| include_str ! ( "assets/default_info.json" ) . to_string ( ) ) ;
48
- parse_info ( & info_file)
44
+ let info: CdnInfo = DeJson :: deserialize_json ( & info_file) . unwrap_or_else ( |_| {
45
+ DeJson :: deserialize_json ( include_str ! ( "assets/default_info.json" ) ) . unwrap ( )
46
+ } ) ;
47
+ info
49
48
}
50
49
51
50
// Write serde json CdnInfo to file
@@ -381,7 +380,7 @@ fn main() {
381
380
} ;
382
381
383
382
let local_info = read_info_file ( & Path :: join ( Path :: new ( & args. directory ) , "cdn_info.json" ) ) ;
384
- let cdn_info = parse_info ( & http:: get_body_string ( & cdn) ) ;
383
+ let cdn_info: CdnInfo = DeJson :: deserialize_json ( & http:: get_body_string ( & cdn) ) . unwrap ( ) ;
385
384
386
385
if args. version_local {
387
386
println ! ( "{}" , local_info. revision) ;
You can’t perform that action at this time.
0 commit comments