File tree 1 file changed +3
-9
lines changed
1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -28,17 +28,11 @@ pub struct GodotVersion {
28
28
29
29
pub fn parse_godot_version ( version_str : & str ) -> Result < GodotVersion , Box < dyn Error > > {
30
30
let regex = Regex :: new (
31
- r#"(\d+)\.(\d+)(?:\.(\d+))?\.(alpha|beta|dev|stable)[0-9]*\.(?:mono)\. (?:(?:official|custom_build)\.([a-f0-9]+)|official)"# ,
31
+ r#"(\d+)\.(\d+)(?:\.(\d+))?\.(alpha|beta|dev|stable)[0-9]*\.(?:mono\.)? (?:(?:official|custom_build)\.([a-f0-9]+)|official)"# ,
32
32
) ?;
33
33
34
- let caps = regex. captures ( version_str) . ok_or ( "Regex capture failed" ) ?;
35
-
36
- let fail = || {
37
- format ! (
38
- "Version substring could not be matched in '{}'" ,
39
- version_str
40
- )
41
- } ;
34
+ let fail = || format ! ( "Version substring cannot be parsed: `{}`" , version_str) ;
35
+ let caps = regex. captures ( version_str) . ok_or_else ( fail) ?;
42
36
43
37
Ok ( GodotVersion {
44
38
full_string : caps. get ( 0 ) . unwrap ( ) . as_str ( ) . to_string ( ) ,
You can’t perform that action at this time.
0 commit comments