@@ -52,23 +52,18 @@ impl FunctionKind {
5252 }
5353
5454 fn machine_applicable_sugg ( & self , primary_span : Span , unwrap_span : Span ) -> Vec < ( Span , String ) > {
55- use FunctionKind :: * ;
56- use SpansKind :: * ;
57-
58- let ( trait_name, fn_name) = {
59- let ( a, b) = match self {
60- TryFromFunction ( _) => ( "From" , "from" ) ,
61- TryIntoFunction ( _) | TryIntoMethod => ( "Into" , "into" ) ,
62- } ;
63- ( a. to_string ( ) , b. to_string ( ) )
55+ let ( trait_name, fn_name) = match self {
56+ FunctionKind :: TryFromFunction ( _) => ( "From" . to_owned ( ) , "from" . to_owned ( ) ) ,
57+ FunctionKind :: TryIntoFunction ( _) | FunctionKind :: TryIntoMethod => ( "Into" . to_owned ( ) , "into" . to_owned ( ) ) ,
6458 } ;
6559
6660 let mut sugg = match * self {
67- TryFromFunction ( Some ( spans) ) | TryIntoFunction ( Some ( spans) ) => match spans {
68- TraitFn { trait_span, fn_span } => vec ! [ ( trait_span, trait_name) , ( fn_span, fn_name) ] ,
69- Fn { fn_span } => vec ! [ ( fn_span, fn_name) ] ,
61+ FunctionKind :: TryFromFunction ( Some ( spans) ) | FunctionKind :: TryIntoFunction ( Some ( spans) ) => match spans {
62+ SpansKind :: TraitFn { trait_span, fn_span } => vec ! [ ( trait_span, trait_name) , ( fn_span, fn_name) ] ,
63+ SpansKind :: Fn { fn_span } => vec ! [ ( fn_span, fn_name) ] ,
7064 } ,
71- TryIntoMethod => vec ! [ ( primary_span, fn_name) ] ,
65+ FunctionKind :: TryIntoMethod => vec ! [ ( primary_span, fn_name) ] ,
66+ // Or the suggestion is not machine-applicable
7267 _ => unreachable ! ( ) ,
7368 } ;
7469
0 commit comments