refactor(project_prompt): replace is_some/is_none+unwrap with let-Some / match (#196, #197)#247
Closed
SAY-5 wants to merge 2 commits intoTrueNine:devfrom
Closed
refactor(project_prompt): replace is_some/is_none+unwrap with let-Some / match (#196, #197)#247SAY-5 wants to merge 2 commits intoTrueNine:devfrom
SAY-5 wants to merge 2 commits intoTrueNine:devfrom
Conversation
Fix two CI failures from previous merge
…ome / match Closes TrueNine#196. Closes TrueNine#197. Two adjacent unwrap-anti-patterns in `enhance_workspace_projects_with_aindex`: - L301-302: `if project.project_type.is_some() { vec![project.project_type.clone().unwrap()] }` → `match &project.project_type { Some(ptype) => vec![ptype.clone()], None => … }` Removes the redundant `is_some()` check, drops the `unwrap()`, and clones only the borrow we actually need (TrueNine#196). - L307-319: `let matching_series = …find(…); if matching_series.is_none() { continue }; let series_name = matching_series.unwrap();` → `let Some(series_name) = …find(…) else { … continue }; …` Single binding, no redundant `is_none()` re-check, no `unwrap()` on the path that already proved `Some` (TrueNine#197). Behaviour is identical; the change is purely an idiom cleanup. The existing `repositories::project_prompt` test coverage (rolled into the 45-test `repositories` suite) stays green.
Owner
|
Merged into dev via cherry-pick. The PR base was changed from main to dev, which caused conflicts because dev had diverged significantly. All commits have been cherry-picked onto dev and pushed. Thanks for the contributions! |
Owner
|
Thank you for the contribution! All commits have been cherry-picked and merged into the dev branch. 🙏 |
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.
Closes #196.
Closes #197.
Two adjacent unwrap-anti-patterns in
enhance_workspace_projects_with_aindex:if project.project_type.is_some() { vec![project.project_type.clone().unwrap()] }→match &project.project_type { Some(ptype) => vec![ptype.clone()], None => … }. Removes the redundantis_some(), drops theunwrap(), and clones only the borrow we actually need.let matching_series = find(…); if matching_series.is_none() { continue }; let series_name = matching_series.unwrap();→let Some(series_name) = find(…) else { … continue };. Single binding, no redundantis_none()re-check, nounwrap()on a path that already provedSome.Behaviour is identical; the change is purely an idiom cleanup.
Test plan
cargo build --manifest-path sdk/Cargo.toml— cleancargo test --manifest-path sdk/Cargo.toml --lib repositories— 45/45 pass