Skip to content

'Convert while to loop' assist removes comments from inside the while block #17869

Closed
@antonilol

Description

@antonilol

rust-analyzer version: 0.4.2068-standalone

rustc version: rustc 1.80.1 (3f5fd8dd4 2024-08-06)

editor or extension: code oss

relevant settings: None

code snippet to reproduce:

let mut i = 0;

while i < 5 {
    // comment 1
    dbg!(i);
    // comment 2
    i += 1;
    // comment 3
}

Converting this while loop to a loop loop using the assist removes all of the comments:

let mut i = 0;

loop {
    if i >= 5 {
        break;
    }
    dbg!(i);
    i += 1;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions