@@ -1549,23 +1549,6 @@ impl Disambiguator {
15491549 fn from_str ( link : & str ) -> Result < Option < ( Self , & str ) > , ( String , Range < usize > ) > {
15501550 use Disambiguator :: { Kind , Namespace as NS , Primitive } ;
15511551
1552- let find_suffix = || {
1553- let suffixes = [
1554- ( "!()" , DefKind :: Macro ( MacroKind :: Bang ) ) ,
1555- ( "()" , DefKind :: Fn ) ,
1556- ( "!" , DefKind :: Macro ( MacroKind :: Bang ) ) ,
1557- ] ;
1558- for & ( suffix, kind) in & suffixes {
1559- if let Some ( link) = link. strip_suffix ( suffix) {
1560- // Avoid turning `!` or `()` into an empty string
1561- if !link. is_empty ( ) {
1562- return Some ( ( Kind ( kind) , link) ) ;
1563- }
1564- }
1565- }
1566- None
1567- } ;
1568-
15691552 if let Some ( idx) = link. find ( '@' ) {
15701553 let ( prefix, rest) = link. split_at ( idx) ;
15711554 let d = match prefix {
@@ -1586,7 +1569,20 @@ impl Disambiguator {
15861569 } ;
15871570 Ok ( Some ( ( d, & rest[ 1 ..] ) ) )
15881571 } else {
1589- Ok ( find_suffix ( ) )
1572+ let suffixes = [
1573+ ( "!()" , DefKind :: Macro ( MacroKind :: Bang ) ) ,
1574+ ( "()" , DefKind :: Fn ) ,
1575+ ( "!" , DefKind :: Macro ( MacroKind :: Bang ) ) ,
1576+ ] ;
1577+ for & ( suffix, kind) in & suffixes {
1578+ if let Some ( link) = link. strip_suffix ( suffix) {
1579+ // Avoid turning `!` or `()` into an empty string
1580+ if !link. is_empty ( ) {
1581+ return Ok ( Some ( ( Kind ( kind) , link) ) ) ;
1582+ }
1583+ }
1584+ }
1585+ Ok ( None )
15901586 }
15911587 }
15921588
0 commit comments