rust/docs/user/assists.md
2019-10-25 14:47:48 +03:00

267 B

Assists

convert_to_guarded_return

Replace a large conditional with a guarded return.

// BEFORE
fn main() {
    <|>if cond {
        foo();
        bar();
    }
}

// AFTER
fn main() {
    if !cond {
        return;
    }
    foo();
    bar();
}