mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Clippy: Fix empty suggestion in from_over_into
Co-authored-by: y21 <30553356+y21@users.noreply.github.com>
This commit is contained in:
parent
798865c593
commit
9ce0b837ad
@ -181,9 +181,6 @@ fn convert_to_from(
|
|||||||
let from = snippet_opt(cx, self_ty.span)?;
|
let from = snippet_opt(cx, self_ty.span)?;
|
||||||
let into = snippet_opt(cx, target_ty.span)?;
|
let into = snippet_opt(cx, target_ty.span)?;
|
||||||
|
|
||||||
let return_type = matches!(sig.decl.output, FnRetTy::Return(_))
|
|
||||||
.then_some(String::from("Self"))
|
|
||||||
.unwrap_or_default();
|
|
||||||
let mut suggestions = vec![
|
let mut suggestions = vec![
|
||||||
// impl Into<T> for U -> impl From<T> for U
|
// impl Into<T> for U -> impl From<T> for U
|
||||||
// ~~~~ ~~~~
|
// ~~~~ ~~~~
|
||||||
@ -200,10 +197,13 @@ fn convert_to_from(
|
|||||||
// fn into([mut] self) -> T -> fn into([mut] v: T) -> T
|
// fn into([mut] self) -> T -> fn into([mut] v: T) -> T
|
||||||
// ~~~~ ~~~~
|
// ~~~~ ~~~~
|
||||||
(self_ident.span, format!("val: {from}")),
|
(self_ident.span, format!("val: {from}")),
|
||||||
|
];
|
||||||
|
|
||||||
|
if let FnRetTy::Return(_) = sig.decl.output {
|
||||||
// fn into(self) -> T -> fn into(self) -> Self
|
// fn into(self) -> T -> fn into(self) -> Self
|
||||||
// ~ ~~~~
|
// ~ ~~~~
|
||||||
(sig.decl.output.span(), return_type),
|
suggestions.push((sig.decl.output.span(), String::from("Self")));
|
||||||
];
|
}
|
||||||
|
|
||||||
let mut finder = SelfFinder {
|
let mut finder = SelfFinder {
|
||||||
cx,
|
cx,
|
||||||
|
Loading…
Reference in New Issue
Block a user