Rust

Rust

By DeepSource

Found occurrence of `Rc<&str>`RS-W1063

Anti-pattern

Rc<&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 Rc<str>.

Examples

Bad practice

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

Recommended

fn get_rc_str() -> Rc<str> {
    Rc::from("string")
}