Skip to content

Conversation

mablr
Copy link
Contributor

@mablr mablr commented Oct 6, 2025

Motivation

Follow-up of #11892 to close #11760 (last part about fix suggestion #11760 (comment))

Solution

  • Updated the named_struct_fields lint to emit suggestion for initializing structs with named fields.
  • Updated test data to reflect the new suggestion format in lint messages.

PR Checklist

  • Added Tests (updated existing one)
  • Added Documentation
  • Breaking changes

…o-fix

- Updated the `NamedStructFields` lint to emit suggestions for initializing structs with named fields.
- Updated test data to reflect the new suggestion format in lint messages.
@mablr mablr marked this pull request as ready for review October 6, 2025 08:38
@onbjerg onbjerg self-assigned this Oct 6, 2025
Copy link
Contributor

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

let's for completeness sake add an example in the test where the number of arguments does not match the struct definition. lint does parsing and lowering, but does not do typeck, so this should be fine.

mablr and others added 2 commits October 6, 2025 13:34
Co-authored-by: onbjerg <onbjerg@users.noreply.github.com>
@onbjerg onbjerg requested a review from 0xrusowsky October 6, 2025 11:43
@onbjerg onbjerg enabled auto-merge (squash) October 6, 2025 11:43
@onbjerg onbjerg merged commit 069d082 into foundry-rs:master Oct 6, 2025
16 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Oct 6, 2025
@jenpaff jenpaff moved this from Done to Completed in Foundry Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

feat: lint to enforce declaring struct fields

3 participants