Skip to content

fix(desktop): rewrite remaining map_or defaults as match arms (clippy + MSRV 1.77) - #6086

Closed
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:devin/1790481900-desktop-mapor-heal
Closed

luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:devin/1790481900-desktop-mapor-heal

Conversation

@luvs01

@luvs01 luvs01 commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Rewrite the remaining Option::map_or call sites the current stable clippy flags with unnecessary_map_or under -D warnings as match arms (native_tray_accounts.rs account is_active fallback, widget.rs should_reload gates).
  • match is behavior-identical and compiles under the pinned rust-version = "1.77"; clippy's suggested is_none_or needs rustc 1.82+.
  • Unblocks the desktop shell CI lane for desktop-touching PRs.

Verification

  • git grep -n "map_or(" desktop/src-tauri/ — no remaining flagged call sites after the change.
  • Local cargo clippy is not runnable on this Windows box (no MSVC toolchain); the desktop shell CI job is the gate and compiles with -D warnings.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Refactor
    • Clarified how the app determines the active account and when to refresh displayed information. User-visible behavior is unchanged.

… + MSRV 1.77)

Co-Authored-By: Epinephrine <luvs01@hanmail.net>
@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 27, 2026
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c21867fa-33f3-4505-b657-30890d213417

📥 Commits

Reviewing files that changed from the base of the PR and between 24b2f39 and 5fa700f.

📒 Files selected for processing (2)
  • desktop/src-tauri/src/native_tray_accounts.rs
  • desktop/src-tauri/src/widget.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Two Option::map_or checks now use explicit match expressions. Account selection and widget reload conditions remain unchanged.

Changes

Explicit match refactors

Layer / File(s) Summary
Replace map_or checks
desktop/src-tauri/src/native_tray_accounts.rs, desktop/src-tauri/src/widget.rs
parse_accounts uses a match to select an account by ID or use the row’s active flag. should_reload uses separate matches to check whether the snapshot changed and the reload interval elapsed.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 5fa70

The account-selection and widget-reload conditions are reported unchanged. No material merge risk is identified.

Architecture Summary

Architecture risk: 🔵 Low · up to 5fa70

The change affects 1 system.

Changed systems: desktop

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — desktop (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in desktop/src-tauri/src/native_tray_accounts.rs: parse_accounts replaces Option::map_or with an explicit match for active-account selection; both forms use the selected ID when present and fall back to the row’s active flag otherwise.
  • observed — Modified behavior in desktop/src-tauri/src/widget.rs: should_reload replaces two chained map_or checks with explicit matches. It still reloads only when the displayed snapshot differs from the previous one (or none exists) and at least RELOAD_INTERVAL_SECONDS has elapsed since the last request (or none exists).
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the changes in native_tray_accounts.rs and widget.rs: replacing remaining map_or defaults with match arms to satisfy Clippy while preserving compatibility with R…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 24 / 80

바탕 브랜치는 dev입니다. 계정 목록에서 지금 쓰는 계정을 고르는 곳과, 맥 위젯이 화면을 다시 그릴지 정하는 곳을 match로 바꿉니다. 고른 계정 아이디가 없으면 그 줄의 active를 보고, 있으면 아이디가 같은지 봅니다. 위젯은 화면에 나오는 내용이 바뀌었고, 마지막 새로고침 뒤 20분이 지났을 때만 다시 그립니다. 예전 map_or와 답이 같습니다. 사람이 보는 동작은 그대로입니다. types.ts와 config.ts를 나누는 글은 아닙니다.

본문은 안정 clippy가 unnecessary_map_or로 desktop shell CI를 막고, 이 PR이 그 막을 푼다고 적습니다. 코드와 CI 로그는 그 말과 다릅니다.

라인 - desktop/src-tauri/src/lib.rs 16–17줄, desktop/src-tauri/src/widget.rs 1줄. native_tray_accounts와 should_reload는 맥에서만 만들어집니다. desktop shell은 우분투에서 clippy를 돌립니다. 그 잡은 이번 두 곳을 검사하지 않습니다.

라인 - desktop/src-tauri/src/native_tray_accounts.rs 183줄. 값이 없을 때의 답이 true나 false 글자가 아니라, 그 줄의 active를 읽은 결과입니다. unnecessary_map_or는 그 답이 true, false, None일 때 나옵니다. 닫힌 #5963도 이 줄은 clippy가 경고하는 자리가 아니라고 적었습니다.

라인 - dev의 desktop shell, 2026-09-27, rustc 1.98.1, job 108544367417, 커밋 dc784d3e. cargo clippy --manifest-path desktop/src-tauri/Cargo.toml --all-targets -- -D warnings가 경고 없이 끝났습니다. 그때 이 PR이 고치는 map_or는 아직 dev에 있었습니다.

메인테이너의 판단이 필요한 지점

결과는 같습니다. CI를 살리는 수정은 아닙니다. 모양만 정리하려고 머지할지, 닫을지 정하면 됩니다. types.ts/config.ts 분할과 겹치지 않아서, 그 이유로 닫을 필요는 없습니다.

너의 추천

CI 복구로 서두르지 않아도 됩니다. 닫아도 됩니다. 남긴다면 match는 이 크레이트의 rust-version = "1.77"에 맞습니다. is_none_or는 1.82부터라 쓰지 않은 점도 맞습니다. 183줄은 clippy가 요구한 자리가 아니니 빼도 됩니다.

이 댓글은 grok-bot이 작성했습니다

@luvs01

luvs01 commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator Author

Closing per review. The premise was wrong: desktop shell runs clippy on ubuntu while both touched files are macOS-only, and the dev run 108544367417 on dc784d3e passed clippy clean with these map_or sites still present. This is a style-only change that does not fix CI, so there is no merge value worth the review slot.

@luvs01 luvs01 closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants