Rust-clippy: allman style brace formatting triggers suspicious_else_formatting

Created on 10 Mar 2019  路  3Comments  路  Source: rust-lang/rust-clippy

.

L-bug L-false-positive

Most helpful comment

Example:

fn main() {
    if true 
    {
        println!("Hi");
    }
    else 
    {
        println!("Bye");
    }
}

Playground

All 3 comments

Example:

fn main() {
    if true 
    {
        println!("Hi");
    }
    else 
    {
        println!("Bye");
    }
}

Playground

I just switched to this style and now all my else-statements are being triggered. Is there at least a way to tell clippy to silence this warning for the whole project? I can't find what to put inside .clippy.toml to silence this, if any such thing exists.

clippy.toml doesn't and won't support allowing/denying lints. You can do this in the main.rs/lib.rs file with #![allow(clippy::suspicious_else_formatting)] at the top of the file.

Was this page helpful?
0 / 5 - 0 ratings