Remove wildcard usage for patterns
This commit is contained in:
parent
015ac10954
commit
fb9fd513f5
@ -52,23 +52,18 @@ impl FunctionKind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn machine_applicable_sugg(&self, primary_span: Span, unwrap_span: Span) -> Vec<(Span, String)> {
|
fn machine_applicable_sugg(&self, primary_span: Span, unwrap_span: Span) -> Vec<(Span, String)> {
|
||||||
use FunctionKind::*;
|
let (trait_name, fn_name) = match self {
|
||||||
use SpansKind::*;
|
FunctionKind::TryFromFunction(_) => ("From".to_owned(), "from".to_owned()),
|
||||||
|
FunctionKind::TryIntoFunction(_) | FunctionKind::TryIntoMethod => ("Into".to_owned(), "into".to_owned()),
|
||||||
let (trait_name, fn_name) = {
|
|
||||||
let (a, b) = match self {
|
|
||||||
TryFromFunction(_) => ("From", "from"),
|
|
||||||
TryIntoFunction(_) | TryIntoMethod => ("Into", "into"),
|
|
||||||
};
|
|
||||||
(a.to_string(), b.to_string())
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut sugg = match *self {
|
let mut sugg = match *self {
|
||||||
TryFromFunction(Some(spans)) | TryIntoFunction(Some(spans)) => match spans {
|
FunctionKind::TryFromFunction(Some(spans)) | FunctionKind::TryIntoFunction(Some(spans)) => match spans {
|
||||||
TraitFn { trait_span, fn_span } => vec![(trait_span, trait_name), (fn_span, fn_name)],
|
SpansKind::TraitFn { trait_span, fn_span } => vec![(trait_span, trait_name), (fn_span, fn_name)],
|
||||||
Fn { fn_span } => vec![(fn_span, fn_name)],
|
SpansKind::Fn { fn_span } => vec![(fn_span, fn_name)],
|
||||||
},
|
},
|
||||||
TryIntoMethod => vec![(primary_span, fn_name)],
|
FunctionKind::TryIntoMethod => vec![(primary_span, fn_name)],
|
||||||
|
// Or the suggestion is not machine-applicable
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user