Skip to content

fix(desktop): remove a needless return that fails clippy on Linux - #2640

Merged
hidb4ai merged 1 commit into
oceanbase:masterfrom
Fengzdadi:fix/desktop-linux-needless-return
Nov 14, 2026
Merged

hidb4ai merged 1 commit into
oceanbase:masterfrom
Fengzdadi:fix/desktop-linux-needless-return

Conversation

@Fengzdadi

Copy link
Copy Markdown
Collaborator

Which issue or RFC does this PR close?

No issue. This PR repairs the desktop-validation / linux check, which fails on master.

Rationale for this change

#2471 added resolve_local_data_dir to desktop/src-tauri/src/ops_bridge.rs. Its body has two blocks: one for Linux and one for every other platform. On Linux the other block is compiled out, so the Linux block's only statement, return resolve_local_data_dir_from(...);, is the last statement of the function. Clippy reports it as needless_return. The job runs cargo clippy --locked --all-targets -- -D warnings, so the Linux build stops there:

error: unneeded `return` statement
  --> src/ops_bridge.rs:48:9
error: could not compile `powercontext-desktop` (lib) due to 1 previous error

macOS and Windows compile the other block and pass. #2471's own desktop-validation / linux run failed the same way. Every pull request that selects the Desktop checks now fails on Linux, for example #2636.

What changes are included in this PR?

The Linux block now evaluates to the call instead of returning it, as clippy suggests. The function returns the same value on every platform. No other code changes.

Are there any user-facing changes?

No.

How was this change tested?

  • rustfmt --edition 2024 --check on the changed file.
  • macOS cannot compile the Linux block. A scratch crate copied the function and replaced the Linux condition with a custom cfg. It was checked with clippy 0.1.99 and -D warnings:
    • With return, clippy reports the same needless_return error.
    • Without it, clippy is clean and the function returns the Linux block's value.
    • With the cfg unset, it returns local_data, as on macOS and Windows.
  • The real check is this PR's desktop-validation / linux job. It is also the first Linux run of the Linux-only tests that feat(desktop): add Linux systemd --user service integration #2471 added in ops_bridge/tests.rs: feat(desktop): add Linux systemd --user service integration #2471's Linux job stopped at clippy and never reached cargo test.
  • Self-review:
    • The change removes only the return keyword and its semicolon. The call and its arguments are unchanged.
    • The rest of feat(desktop): add Linux systemd --user service integration #2471's Linux-only code was checked for other statements of this shape. In fixture_dir in ops_bridge/tests.rs, the return is under #[cfg(target_os = "macos")] and passes clippy on the macOS jobs, so it is left as it is.

AI usage statement

Claude Code (Claude Opus 5.5) found the failure in the CI logs, made the change, ran the checks above, and wrote this description.

On Linux, resolve_local_data_dir ends with a cfg(target_os = "linux")
block whose only statement is `return resolve_local_data_dir_from(...);`,
because the other block is compiled out. Clippy reports it as
needless_return, and desktop-validation runs clippy with -D warnings, so
the Linux build has stopped there since oceanbase#2471.

The block now evaluates to the call, which returns the same value.

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed d6ab408. No actionable findings. Removing the redundant return and semicolon preserves the cfg-selected return value and fixes the Linux Clippy failure without suppressing the lint. No database tables or interfaces are added or changed. Verified the corresponding Linux CI Clippy/test execution and successful Windows and both macOS checks; local Rust 1.95.0 formatting and diff checks also pass. Merge confidence: 98/100.

@hidb4ai
hidb4ai merged commit 65bcb97 into oceanbase:master Nov 14, 2026
44 checks passed
@hidb4ai hidb4ai added the 1.5.2 v1.5.2 release tracking label Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.5.2 v1.5.2 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants