Skip to content

"Invert if" action is incorrect with boolean operators #6867

@Nadrieril

Description

@Nadrieril

In the following, if I apply the "invert if" action, I get:

fn main() {
    if true || false {
        println!("1");
    } else {
        println!("2");
    }
}

===>

fn main() {
    if !true || false {
        println!("2");
    } else {
        println!("1");
    }
}

which is lacking the required parens.

PS: sorry for the issue spamming, I've just started using rust-analyzer so I'm playing with it a bit x)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-assistsS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions