Skip to content

Suggest removing {} on structs with empty "bodies" #8591

Closed
@JosephTLyons

Description

@JosephTLyons

What it does

Checks for struct declarations with empty bodies and suggests removing the {}
Checks for instantiation of structs that have empty bodies and suggests removing the {}

Lint Name

No response

Category

style

Advantage

Makes the code look a little tidier.

Drawbacks

Not sure...

Example 1

struct Dog {}

Could be written as:

struct Dog;

Example 2

// Assuming `struct Dog;` exists
let dog = Dog {};

Could be written as:

// Assuming `struct Dog;` exists
let dog = Dog;

Metadata

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions