} else if other_gets_derefed {
// suggest dropping the to_owned on the left and the deref on the right
let other_snippet = snippet(cx, other.span, "..").into_owned();
- let other_without_deref = other_snippet.trim_left_matches('*');
+ let other_without_deref = other_snippet.replacen('*', "", 1);
(expr.span.to(other.span), format!("{} == {}", snip.to_string(), other_without_deref))
} else {
--> $DIR/cmp_owned.rs:47:5
|
47 | y.to_owned() == **x;
- | ^^^^^^^^^^^^^^^^^^^ help: try: `y == x`
+ | ^^^^^^^^^^^^^^^^^^^ help: try: `y == *x`
error: this creates an owned instance just for comparison
--> $DIR/cmp_owned.rs:54:9