-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedS-fixedStatus: Issues that got fixed, waiting to be closed as completedStatus: Issues that got fixed, waiting to be closed as completed
Description
Summary
let_unit_value
suggestion is turning a statement like println!("{a:?});
into println!("{():?});
Lint Name
let_unit_value
Reproducer
I tried this code:
let a = vec![1,2,3].resize(0, 5);
println!("{a:?}");
I saw this happen:
warning: this let-binding has unit value
--> src/main.rs:4:1
|
4 | let a = vec![1,2,3].resize(0, 5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
= note: `#[warn(clippy::let_unit_value)]` on by default
help: omit the `let` binding and replace variable usages with `()`
|
4 + vec![1,2,3].resize(0, 5);
5 ~ println!("{():?}");
|
I expected to see this happen:
warning: this let-binding has unit value
--> src/main.rs:4:1
|
4 | let a = vec![1,2,3].resize(0, 5);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value
= note: `#[warn(clippy::let_unit_value)]` on by default
help: omit the `let` binding and replace variable usages with `()`
|
4 + vec![1,2,3].resize(0, 5);
5 ~ println!("{:?}", ());
|
Version
1.89 stable rustc
0.1.89 (2025-08-04 29483883ee)
Additional Labels
@rustbot label: +I-suggestion-causes-error
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedS-fixedStatus: Issues that got fixed, waiting to be closed as completedStatus: Issues that got fixed, waiting to be closed as completed