From 2d050f4b2f6057ea0ac63a3d8d37c05992e4ee3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=C3=A9nore=20Bouttefeux?= Date: Fri, 16 Apr 2021 19:38:01 +0200 Subject: [PATCH 1/2] add type in help of from over Into --- clippy_lints/src/from_over_into.rs | 2 +- tests/ui/from_over_into.stderr | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/clippy_lints/src/from_over_into.rs b/clippy_lints/src/from_over_into.rs index e5ec245e5029..5e2baba89434 100644 --- a/clippy_lints/src/from_over_into.rs +++ b/clippy_lints/src/from_over_into.rs @@ -73,7 +73,7 @@ impl LateLintPass<'_> for FromOverInto { cx.tcx.sess.source_map().guess_head_span(item.span), "an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true", None, - "consider to implement `From` instead", + &format!("consider to implement `From<{}>` instead", impl_trait_ref.self_ty()), ); } } diff --git a/tests/ui/from_over_into.stderr b/tests/ui/from_over_into.stderr index b101d2704fbd..fb391759dce6 100644 --- a/tests/ui/from_over_into.stderr +++ b/tests/ui/from_over_into.stderr @@ -5,7 +5,6 @@ LL | impl Into for String { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D clippy::from-over-into` implied by `-D warnings` - = help: consider to implement `From` instead + = help: consider to implement `From` instead error: aborting due to previous error - From ccd0f0b4af77e7bb1aaf214852f4c4d7e6d6b60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=C3=A9nore=20Bouttefeux?= Date: Fri, 16 Apr 2021 20:13:25 +0200 Subject: [PATCH 2/2] added missing line in test ouput --- tests/ui/from_over_into.stderr | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ui/from_over_into.stderr b/tests/ui/from_over_into.stderr index fb391759dce6..2951e6bdac43 100644 --- a/tests/ui/from_over_into.stderr +++ b/tests/ui/from_over_into.stderr @@ -8,3 +8,4 @@ LL | impl Into for String { = help: consider to implement `From` instead error: aborting due to previous error +