Rust

Rust

Made by DeepSource

Comparing with "" or [] when .is_empty() could be used RS-W1102

Anti-pattern
Minor

The intent expressed by .is_empty() is a lot clearer than comparison to "" or []. Prefer .is_empty() where applicable.

Bad practice

let s = "hello";
if s == "" {
    // ...
}

Recommended

let s = "hello";
if s.is_empty() {
    // ...
}