@@ -1451,12 +1451,6 @@ impl Symbol {
1451
1451
with_interner ( |interner| interner. intern ( string) )
1452
1452
}
1453
1453
1454
- /// Access the symbol's chars. This is a slowish operation because it
1455
- /// requires locking the symbol interner.
1456
- pub fn with < F : FnOnce ( & str ) -> R , R > ( self , f : F ) -> R {
1457
- with_interner ( |interner| f ( interner. get ( self ) ) )
1458
- }
1459
-
1460
1454
/// Convert to a `SymbolStr`. This is a slowish operation because it
1461
1455
/// requires locking the symbol interner.
1462
1456
pub fn as_str ( self ) -> SymbolStr {
@@ -1484,19 +1478,19 @@ impl Symbol {
1484
1478
1485
1479
impl fmt:: Debug for Symbol {
1486
1480
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1487
- self . with ( |str| fmt:: Debug :: fmt ( & str , f) )
1481
+ fmt:: Debug :: fmt ( & self . as_str ( ) , f)
1488
1482
}
1489
1483
}
1490
1484
1491
1485
impl fmt:: Display for Symbol {
1492
1486
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1493
- self . with ( |str| fmt:: Display :: fmt ( & str , f) )
1487
+ fmt:: Display :: fmt ( & self . as_str ( ) , f)
1494
1488
}
1495
1489
}
1496
1490
1497
1491
impl < S : Encoder > Encodable < S > for Symbol {
1498
1492
fn encode ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
1499
- self . with ( |string| s. emit_str ( string ) )
1493
+ s. emit_str ( & self . as_str ( ) )
1500
1494
}
1501
1495
}
1502
1496
0 commit comments