Skip to content

feat: lints for redundant field names and needless struct updates#805

Merged
ivov merged 1 commit into
mainfrom
struct-literal-cleanup-lints
Jun 21, 2026
Merged

feat: lints for redundant field names and needless struct updates#805
ivov merged 1 commit into
mainfrom
struct-literal-cleanup-lints

Conversation

@ivov

@ivov ivov commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Adds two advisories that flag redundant struct-literal syntax.

  [info] Redundant field name
   ╭─[test.lis:7:11]
 6 │ fn make(x: int) -> Point {
 7 │   Point { x: x, y: 0 }
   ·           ──┬─
   ·             ╰── can be simpler
 8 │ }
   ╰────
  help: Replace `x: x` with `x` · code: [lint.redundant_field_names]
  [info] Needless struct update
   ╭─[test.lis:7:35]
 6 │ fn rebuild(base: Config) -> Config {
 7 │   Config { debug: true, port: 80, ..base }
   ·                                   ───┬──
   ·                                      ╰── has no effect
 8 │ }
   ╰────
  help: Remove `..base` · code: [lint.needless_update]

@ivov ivov merged commit e9038b5 into main Jun 21, 2026
16 checks passed
@ivov ivov mentioned this pull request Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant