From 2fc1693cd577eb8af48b75518945a71f1652711c Mon Sep 17 00:00:00 2001 From: Kartavya Vashishtha Date: Mon, 6 Feb 2023 21:34:35 +0530 Subject: [PATCH] split suggestions into two separate suggestions --- clippy_lints/src/methods/suspicious_to_owned.rs | 12 +++++++++--- 1 file 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 62eeb3f7a..e818f1892 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 ); }