Skip to content

Commit

Permalink
chore: resolve clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
adalinesimonian committed Jan 18, 2025
1 parent 9b9753b commit b10bc7a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
run: cargo fmt -- --check

- name: Check clippy
shell: bash
run: |
cargo clippy --all-targets --all-features -- \
-D clippy::suspicious -D clippy::style -D clippy::complexity \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
run: cargo fmt -- --check

- name: Check clippy
shell: bash
run: |
cargo clippy --all-targets --all-features -- \
-D clippy::suspicious -D clippy::style -D clippy::complexity \
Expand Down
1 change: 1 addition & 0 deletions src/godot_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ fn verify_sha512(
/// - `Ok(Some(PathBuf))` containing the path to the Godot executable if found.
/// - `Ok(None)` if no executable is found.
/// - `Err(io::Error)` if there is an error reading the directory.
#[allow(unused_variables)]
fn find_godot_executable(version_dir: &Path, console: bool) -> Result<Option<PathBuf>> {
// Collect all entries (files/folders) under version_dir
let entries: Vec<_> = fs::read_dir(version_dir)?
Expand Down
20 changes: 4 additions & 16 deletions src/project_version_detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ use crate::version_utils::GodotVersion;
/// is specified in `config/features`.
pub fn detect_godot_version_in_path<P: AsRef<Path>>(i18n: &I18n, path: P) -> Option<GodotVersion> {
// Find the project root by walking up until we find `project.godot`.
let project_file = match find_project_file(path.as_ref()) {
Some(p) => p,
None => return None,
};
let project_file = find_project_file(path.as_ref())?;

// Parse the file, looking for the `[application]` section and
// `config/features=PackedStringArray(...)`.
Expand Down Expand Up @@ -47,26 +44,17 @@ pub fn detect_godot_version_in_path<P: AsRef<Path>>(i18n: &I18n, path: P) -> Opt
}

// Extract lines for `[application]` section.
let application_lines = match extract_application_section(&contents) {
Some(lines) => lines,
None => return None,
};
let application_lines = extract_application_section(&contents)?;

// Look for `config/features` line and parse out version.
let features_line = application_lines
.iter()
.find(|line| line.trim_start().starts_with("config/features="));

let features_line = match features_line {
Some(line) => line,
None => return None,
};
let features_line = features_line?;

// Expects something like: config/features=PackedStringArray("4.3", "Forward Plus")
let version_candidate = match parse_packed_string_array_for_version(features_line) {
Some(v) => v,
None => return None,
};
let version_candidate = parse_packed_string_array_for_version(features_line)?;

// Parse the version string x.x or x.x.x into GodotVersion.
match parse_version_string(&version_candidate) {
Expand Down

0 comments on commit b10bc7a

Please sign in to comment.