about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKartavya Vashishtha <sendtokartavya@gmail.com>2023-02-06 21:34:35 +0530
committerKartavya Vashishtha <sendtokartavya@gmail.com>2023-02-06 21:34:35 +0530
commit2fc1693cd577eb8af48b75518945a71f1652711c (patch)
tree23eecb7dab86449b05e95afccf7f7782bca6e466
parent63a57ee1c381ec8ee0dec13213619113f030d773 (diff)
downloadrust-2fc1693cd577eb8af48b75518945a71f1652711c.tar.gz
rust-2fc1693cd577eb8af48b75518945a71f1652711c.zip
split suggestions into two separate suggestions
-rw-r--r--clippy_lints/src/methods/suspicious_to_owned.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/clippy_lints/src/methods/suspicious_to_owned.rs b/clippy_lints/src/methods/suspicious_to_owned.rs
index 62eeb3f7a4e..e818f1892e5 100644
--- a/clippy_lints/src/methods/suspicious_to_owned.rs
+++ b/clippy_lints/src/methods/suspicious_to_owned.rs
@@ -29,10 +29,16 @@ pub fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr<'_>) -
                     "this `to_owned` call clones the {input_type} itself and does not cause the {input_type} contents to become owned"
                 )),
                 |diag| {
-                    diag.span_suggestions(
+                    diag.span_suggestion(
                         expr.span,
-                        "depending on intent, either make the Cow an Owned variant or clone the Cow itself",
-                        [format!("{recv_snip}.into_owned()"), format!("{recv_snip}.clone()")],
+                        "depending on intent, either make the Cow an Owned variant",
+                        format!("{recv_snip}.into_owned()"),
+                        app
+                    );
+                    diag.span_suggestion(
+                        expr.span,
+                        "or clone the Cow itself",
+                        format!("{recv_snip}.clone()"),
                         app
                     );
                 }