Skip to content

Lint to warn on empty blocks #10868

Closed
@Centri3

Description

@Centri3

What it does

Emits a warning on empty blocks (no statements nor an expression).

Advantage

This is always unnecessary (afaik), and even on the off chance it mutates something else (like potentially in the condition for an if), the if can be entirely removed, leaving just the condition.

Drawbacks

None

Example

if i_mutate_a_variable(&mut owo) {}
let _x = {};

Could be written as:

i_mutate_a_variable(&mut owo);
// <removed>

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