Why is this an issue?

Empty statements represented by a semicolon ; are statements that do not perform any operation. They are often the result of a typo or a misunderstanding of the language syntax. It is a good practice to remove empty statements since they don’t add value and lead to confusion and errors.

Code examples

Noncompliant code example

fn main() {
    let x = 5;

    if x > 0 {
        println!("x is positive");
    }; // Noncompliant

    match x {
        1 => println!("x is one"),
        2 => println!("x is two"),
        _ => println!("x is something else"),
    }; // Noncompliant
}

Compliant solution

fn main() {
    let x = 5;

    if x > 0 {
        println!("x is positive");
    }

    match x {
        1 => println!("x is one"),
        2 => println!("x is two"),
        _ => println!("x is something else"),
    }
}

Resources

Documentation