Enforce MacosNative app config validation with pattern matching#136
Merged
Conversation
Replace the inner if-let-none check with destructured `None` patterns to satisfy clippy::collapsible_match (rust 1.95 stable). The catch-all `_` arm continues to handle the valid configurations.
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Tip: cubic could auto-approve low-risk PRs like this, if it thinks it's safe to merge. Learn more
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactored the MacosNative app configuration validation to use exhaustive pattern matching instead of runtime checks, making invalid configurations impossible to construct.
Key Changes
validate_app_configfunction to pattern match onMacosNative { bundle_id: None, app_path: None }directlyif bundle_id.is_none() && app_path.is_none()checkNone, as this is the only case the pattern matchesImplementation Details
This change leverages Rust's pattern matching to make the validation more explicit and type-safe. By matching on the specific case where both
bundle_idandapp_pathareNone, the code makes it clear that this is an invalid configuration state. The error is now returned directly rather than being conditional, improving code clarity and reducing the possibility of logic errors.https://claude.ai/code/session_01JeA7bssA8UsoiQXhRBxGnV
Summary by cubic
Refactors MacosNative app config validation to match on the exact invalid state (both bundle_id and app_path are None) and return the error directly. Removes the inner conditional, keeps behavior the same (still requires at least one value), and satisfies clippy::collapsible_match.
Written for commit 23a4732. Summary will update on new commits.