Skip to content

Commit 2fc1693

Browse files
committed
split suggestions into two separate suggestions
1 parent 63a57ee commit 2fc1693

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

clippy_lints/src/methods/suspicious_to_owned.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ pub fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) -
2929
"this `to_owned` call clones the {input_type} itself and does not cause the {input_type} contents to become owned"
3030
)),
3131
|diag| {
32-
diag.span_suggestions(
32+
diag.span_suggestion(
3333
expr.span,
34-
"depending on intent, either make the Cow an Owned variant or clone the Cow itself",
35-
[format!("{recv_snip}.into_owned()"), format!("{recv_snip}.clone()")],
34+
"depending on intent, either make the Cow an Owned variant",
35+
format!("{recv_snip}.into_owned()"),
36+
app
37+
);
38+
diag.span_suggestion(
39+
expr.span,
40+
"or clone the Cow itself",
41+
format!("{recv_snip}.clone()"),
3642
app
3743
);
3844
}

0 commit comments

Comments
 (0)