Skip to content

fix unfulfilled_lint_expectations incorrectly triggered by #[expect(clippy::let_and_return)] - #17045

Open
Gri-ffin wants to merge 1 commit into
rust-lang:masterfrom
Gri-ffin:issue-16451
Open

fix unfulfilled_lint_expectations incorrectly triggered by #[expect(clippy::let_and_return)]#17045
Gri-ffin wants to merge 1 commit into
rust-lang:masterfrom
Gri-ffin:issue-16451

Conversation

@Gri-ffin

@Gri-ffin Gri-ffin commented May 21, 2026

Copy link
Copy Markdown
Contributor

fixes #16451

when return expression has lint level attributes, skip the non whitespace check and let the lint fire normally so #[expect] can fulfil it.

changelog: [let_and_return]: fix #[expect] on return expression causing spurious unfulfilled_lint_expectations

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label May 21, 2026
@rustbot

rustbot commented May 21, 2026

Copy link
Copy Markdown
Collaborator

r? @llogiq

rustbot has assigned @llogiq.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, llogiq, samueltardieu

let retexpr_attrs = cx.tcx.hir_attrs(retexpr.hir_id);
retexpr_attrs
.iter()
.any(|a| a.name().is_some_and(|name| Level::from_symbol(name, || Some(a.id())).is_some()))

@Gri-ffin Gri-ffin May 21, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

realistically expect is the only case that makes sense here, but I handled all other lint levels for thoroughness sake.

View changes since the review

@rustbot

This comment has been minimized.

@rustbot

rustbot commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

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

rustbot commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #17369) 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

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.

unfulfilled_lint_expectations is incorrectly being triggered by expect(clippy::let_and_return)

3 participants