Rust

Rust

Made by DeepSource

Empty call to new() RS-W1079

Anti-pattern
Minor

The new() function is used to initialise an object with specific data. If no arguments are passed, the behaviour is identical to default().

Replace it with default() instead.

Bad practice

fn foo() {
    let s = String::new();
    let p = Path::new();
}

Recommended

fn foo() {
    let s = String::default();
    let p = Path::default();
}