rust-lang / rust-lang/rust-analyzer
“Inline variable” assist doesn't adjust formatting macros
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 0.4.2014-standalone (b33a0cae3 2024-06-26)
rustc version: rustc 1.81.0-nightly (bcf94dec5 2024-06-23)
editor or extension: VSCode
code snippet to reproduce:
fn foo() {
let numerator = 1;
let denominator = 64;
println!("{numerator}/{denominator}");
}
Apply the “Inline variable” assist to numerator. The result is
fn foo() {
let denominator = 64;
println!("{numerator}/{denominator}");
}
which leaves numerator undefined. The result should instead be
fn foo() {
let denominator = 64;
println!("{numerator}/{denominator}", numerator = 1);
}
@rustbot label +A-assists
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with rust-analyzer's “Inline variable” assist and reproduce the provided Rust snippet in VSCode. The fix is done when inlining numerator leaves valid formatting-macro syntax, including an explicit numerator = 1 argument, and the undefined reference no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100