@@ -14,10 +14,7 @@ use crate::version_utils::GodotVersion;
1414/// is specified in `config/features`.
1515pub fn detect_godot_version_in_path < P : AsRef < Path > > ( i18n : & I18n , path : P ) -> Option < GodotVersion > {
1616 // Find the project root by walking up until we find `project.godot`.
17- let project_file = match find_project_file ( path. as_ref ( ) ) {
18- Some ( p) => p,
19- None => return None ,
20- } ;
17+ let project_file = find_project_file ( path. as_ref ( ) ) ?;
2118
2219 // Parse the file, looking for the `[application]` section and
2320 // `config/features=PackedStringArray(...)`.
@@ -47,26 +44,17 @@ pub fn detect_godot_version_in_path<P: AsRef<Path>>(i18n: &I18n, path: P) -> Opt
4744 }
4845
4946 // Extract lines for `[application]` section.
50- let application_lines = match extract_application_section ( & contents) {
51- Some ( lines) => lines,
52- None => return None ,
53- } ;
47+ let application_lines = extract_application_section ( & contents) ?;
5448
5549 // Look for `config/features` line and parse out version.
5650 let features_line = application_lines
5751 . iter ( )
5852 . find ( |line| line. trim_start ( ) . starts_with ( "config/features=" ) ) ;
5953
60- let features_line = match features_line {
61- Some ( line) => line,
62- None => return None ,
63- } ;
54+ let features_line = features_line?;
6455
6556 // Expects something like: config/features=PackedStringArray("4.3", "Forward Plus")
66- let version_candidate = match parse_packed_string_array_for_version ( features_line) {
67- Some ( v) => v,
68- None => return None ,
69- } ;
57+ let version_candidate = parse_packed_string_array_for_version ( features_line) ?;
7058
7159 // Parse the version string x.x or x.x.x into GodotVersion.
7260 match parse_version_string ( & version_candidate) {
0 commit comments