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
Copy link
Copy Markdown
Contributor

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

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
Copy link
Copy Markdown
Collaborator

rustbot commented May 21, 2026

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()))
Copy link
Copy Markdown
Contributor Author

@Gri-ffin Gri-ffin May 21, 2026

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

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