Skip to content

A new lint for an assignment statement a = b = c #6576

Closed
@fiveseven-lambda

Description

@fiveseven-lambda

What it does

regarding to: https://stackoverflow.com/questions/65661530/why-can-assignment-operator-be-chained-in-rust

One might assume an assignment statement a = b = c; to be equivalent to a = c; b = c;, but it isn't.

There seems to be very few cases, if any, where we would intentionally write a = b = c;.

It would be nice if clippy warned such an assignment.

Categories (optional)

  • Kind: correctness

Drawbacks

None.

Example

a = b = c;

Could be written as:

b = c;
a = ();

Or the programmer might have intended:

a = c;
b = c;

Metadata

Metadata

Assignees

Labels

A-lintArea: New lintsgood first issueThese issues are a good way to get started with Clippy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions