chore: fix new clippy warnings (derive default)#19
Conversation
Comment on lines
49
to
52
| Middle, | ||
| } | ||
|
|
||
| impl Default for MouseButton { | ||
| fn default() -> Self { | ||
| Self::Left | ||
| } | ||
| } | ||
|
|
||
| impl From<tray_icon::MouseButton> for MouseButton { |
There was a problem hiding this comment.
Bug: The From<tray_icon::MouseButtonState> implementation incorrectly inverts the mapping, causing Up to become Down and vice versa.
Severity: HIGH
Suggested Fix
Correct the From<tray_icon::MouseButtonState> implementation to map the states directly without inversion: tray_icon::MouseButtonState::Up should map to MouseButtonState::Up, and tray_icon::MouseButtonState::Down should map to MouseButtonState::Down.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: crates/tauri/src/tray/mod.rs#L48-L52
Potential issue: The `From` implementation for `MouseButtonState` incorrectly inverts
the state from the underlying `tray_icon` crate. It maps
`tray_icon::MouseButtonState::Up` (button released) to `MouseButtonState::Down`, and
`tray_icon::MouseButtonState::Down` (button pressed) to `MouseButtonState::Up`. This
will cause all tray icon mouse button events to report the opposite state, breaking any
application logic that relies on detecting button presses or releases, including the
project's own example code.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
Benchmark PR from qodo-benchmark#150