Rust

Rust

Made by DeepSource

Found occurrence of Box<&str> RS-W1059

Anti-pattern
Minor

Box<&str> is redundant, use Box<str> instead.

Box<&str> is a pointer to a pointer. This adds another level of indirection without any benefit whatsoever. If the intention is to place a str on the heap, consider using Box<str> or String.

Bad practice

fn get_box_str() -> Box<&'static str> {
    Box::from("string")
}

Recommended

fn get_box_str() -> Box<str> {
    Box::from("string")
}