-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.L-unused_assignmentsLint: unused_assignmentsLint: unused_assignmentsS-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Description
Summary
Clippy shipped with Rust 1.92.0-beta.3 doesn't report unused_assignments when a vector is initialized and then replaced with another value unconditionally.
Lint Name
unused_assignments
Reproducer
I tried this code:
fn main() {
let mut value = b"0".to_vec();
value = b"1".to_vec();
println!("{:?}", value);
}I expected to see this happen:
$ cargo +stable clippy
warning: value assigned to `value` is never read
--> src/main.rs:2:13
|
2 | let mut value = b"0".to_vec();
| ^^^^^
|
= help: maybe it is overwritten before being read?
= note: `#[warn(unused_assignments)]` (part of `#[warn(unused)]`) on by default
Instead, this happened:
$ cargo +beta clippy
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s
Nightly is affected too.
Version
rustc 1.92.0-beta.3 (f3f12444a 2025-11-09)
binary: rustc
commit-hash: f3f12444a017add0468f683f3a10656d29438a05
commit-date: 2025-11-09
host: x86_64-unknown-linux-gnu
release: 1.92.0-beta.3
LLVM version: 21.1.3
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.L-unused_assignmentsLint: unused_assignmentsLint: unused_assignmentsS-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.