rust-analyzer: vscode freezes when trying to apply clippy suggestion

code

fn main() {
    let x = 1;
    let b = 3;

    if x == b {
        if b == x {
            println!("y");
        }
    }
}

when trying to apply the clippy::collapsible_if fix hint via the rla plugin, vscode freezes with 100% cpu load.

rla @ 5fd9a5be0984faa138281e46dd4b73cfdad073b1 code

1.37.1
f06011ac164ae4dc8e753a3fe7f9549844d15e35
x64

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (19 by maintainers)

Most upvoted comments

It works just fine for me. Clippy called the suggestion try though:

warning: this `if` statement can be collapsed
 --> src/main.rs:5:5
  |
5 | /     if x == b {
6 | |         if b == x {
7 | |             println!("y");
8 | |         }
9 | |     }
  | |_____^
  |
  = note: `#[warn(clippy::collapsible_if)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
help: try
  |
5 |     if x == b && b == x {
6 |         println!("y");
7 |     }
  |

Edit: opened https://github.com/rust-lang/rust-clippy/pull/5732

No, I’m updating ra almost daily.

ra_lsp_server --version
rust-analyzer 875352b

using cargo xtask install unless something changed about the installation procedure…?