Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rust-analyzer adds "rewriting static" at the top of the file if the static or const keywords are being used in code

I use neovim (kickstart) and have the rust-analyzer Lsp activated, for rust files. Whenever I write static or const in my code, the Lsp adds "rewriting static" at the top of the file. When I say LspStop it does (obviously) not happen anymore.

However, this happens only in one project, where I am currently following this tutorial: Writing an OS in Rust

I have also setup a completely new project and it does not add "rewriting static" when I include static or const in my code.

like image 645
Havelex Avatar asked Oct 19 '25 11:10

Havelex


1 Answers

You're probably just running a faulty version of rustfmt. Running rustup update fixed it for me.

Issue: https://github.com/rust-lang/rustfmt/issues/6210

Fix: https://github.com/rust-lang/rust/pull/126888

like image 174
Justin Chang Avatar answered Oct 22 '25 05:10

Justin Chang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!