Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implicit_return false positive inside tauri::command macro #12872

Closed
jsimonrichard opened this issue May 31, 2024 · 1 comment · Fixed by #12963
Closed

implicit_return false positive inside tauri::command macro #12872

jsimonrichard opened this issue May 31, 2024 · 1 comment · Fixed by #12963
Assignees
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have L-restriction Lint: Belongs in the restriction lint group T-macros Type: Issues with macros and macro expansion

Comments

@jsimonrichard
Copy link

jsimonrichard commented May 31, 2024

Summary

I'm denying implicit_return (for readability) with a Tauri project which includes async commands. Somewhere inside the tauri::command macro or the tauri::generate_handler macro, there's an implicit return that clippy is picking up on (but only when the command function is async).

But it's my understanding that clippy lints like this one should not be applied to the code inside macros (especially external ones). And obviously I can't control the code style of an external crate.

Lint Name

implicit_return

Reproducer

I've provided a minimal reproducible example repo here: https://github.com/jsimonrichard/clippy-implicit_return-tauri-command-macro-issue-mre

I saw this happen:

error: missing `return` statement
  --> src/main.rs:5:1
   |
5  | #[tauri::command]
   | ^^^^^^^^^^^^^^^^^ help: add `return` as shown: `return #[tauri::command]`
...
12 |         .invoke_handler(tauri::generate_handler![greet])
   |                         ------------------------------- in this macro invocation

I expected to see this happen: no error.

Version

rustc 1.78.0 (9b00956e5 2024-04-29)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: x86_64-unknown-linux-gnu
release: 1.78.0
LLVM version: 18.1.2

Additional Labels

No response

@jsimonrichard jsimonrichard added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels May 31, 2024
@J-ZhengLi J-ZhengLi added T-macros Type: Issues with macros and macro expansion L-restriction Lint: Belongs in the restriction lint group labels May 31, 2024
@lochetti
Copy link
Contributor

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have L-restriction Lint: Belongs in the restriction lint group T-macros Type: Issues with macros and macro expansion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants