Skip to content

Conversation

@Wassasin
Copy link

@Wassasin Wassasin commented Dec 15, 2025

changelog: [unused_async_trait_impl]: new lint

Adds Lint that checks for trait impl functions that are unnecessarily async. By rewriting them to return a core::future::ready an unnecessary coroutine is prevented.

In an embedded context having many trivial async blocks potentially hurts code size significantly. This lint enables projects to quickly find the cases that this applies to.

@Wassasin Wassasin force-pushed the unused_async_trait_impl branch 2 times, most recently from 07c84ff to 29282db Compare December 15, 2025 15:56
@rustbot

This comment has been minimized.

@Wassasin Wassasin marked this pull request as ready for review January 5, 2026 10:16
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 5, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 5, 2026

r? @dswij

rustbot has assigned @dswij.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Jan 5, 2026
@Wassasin Wassasin force-pushed the unused_async_trait_impl branch from 265ec66 to cf7dc77 Compare January 5, 2026 10:18
@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Jan 5, 2026
@rustbot

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jan 12, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Jan 12, 2026
@Wassasin Wassasin force-pushed the unused_async_trait_impl branch from ac92856 to 2c59897 Compare January 12, 2026 09:38
@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Jan 12, 2026
Copy link
Contributor

@ada4a ada4a left a comment

Choose a reason for hiding this comment

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

I like the idea a lot! Left some suggestions

View changes since this review

Copy link
Contributor

@ada4a ada4a left a comment

Choose a reason for hiding this comment

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

Some more things, mostly concerning diagnostics

View changes since this review

@Wassasin Wassasin force-pushed the unused_async_trait_impl branch from 9cdd101 to 6bd9e3a Compare January 14, 2026 09:06
@Wassasin Wassasin force-pushed the unused_async_trait_impl branch from 3a8be29 to c9ee761 Compare January 14, 2026 10:07
Copy link
Contributor

@ada4a ada4a left a comment

Choose a reason for hiding this comment

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

Awesome that you were able to get the indentation to work! There is just one thing I'm unsure about (and one smaller point)

View changes since this review

Copy link
Contributor

@ada4a ada4a left a comment

Choose a reason for hiding this comment

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

Awesome work, I don't think I have anything else to add:)

Let's wait for an actual reviewer to look at this now

View changes since this review

@ada4a
Copy link
Contributor

ada4a commented Jan 14, 2026

Ah, one small thing regarding the PR description:

changelog: [unused_async_trait_impl]: added lint that checks for trait impl functions that are unnecessarily async. By rewriting them to return a core::future::ready an unnecessary coroutine is prevented.

This is a bit long of a changelog message 😅 You could leave it at just

changelog: [unused_async_trait_impl]: new lint

and put the actual description onto a separate paragraph.

Unsure about if this is the right method to replace the relevant code spans. Any feedback is very welcome.

I think this is resolved now? If so, feel free to remove (to reduce clutter in the eventual merge commit message)

@Wassasin
Copy link
Author

Awesome work, I don't think I have anything else to add:)

Let's wait for an actual reviewer to look at this now

View changes since this review

Thank you for your amazing help & feedback! I learned a lot about Clippy thanks to you!

@ada4a
Copy link
Contributor

ada4a commented Jan 14, 2026

Thank you for the kind words:) Glad to have helped!

ada4a added a commit to ada4a/rust-clippy that referenced this pull request Jan 14, 2026
ada4a added a commit to ada4a/rust-clippy that referenced this pull request Jan 14, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 15, 2026

☔ The latest upstream changes (possibly 60b3ecf) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants