@@ -1549,23 +1549,6 @@ impl Disambiguator {
1549
1549
fn from_str ( link : & str ) -> Result < Option < ( Self , & str ) > , ( String , Range < usize > ) > {
1550
1550
use Disambiguator :: { Kind , Namespace as NS , Primitive } ;
1551
1551
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
-
1569
1552
if let Some ( idx) = link. find ( '@' ) {
1570
1553
let ( prefix, rest) = link. split_at ( idx) ;
1571
1554
let d = match prefix {
@@ -1586,7 +1569,20 @@ impl Disambiguator {
1586
1569
} ;
1587
1570
Ok ( Some ( ( d, & rest[ 1 ..] ) ) )
1588
1571
} 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 )
1590
1586
}
1591
1587
}
1592
1588
0 commit comments