@@ -1451,12 +1451,6 @@ impl Symbol {
14511451 with_interner ( |interner| interner. intern ( string) )
14521452 }
14531453
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-
14601454 /// Convert to a `SymbolStr`. This is a slowish operation because it
14611455 /// requires locking the symbol interner.
14621456 pub fn as_str ( self ) -> SymbolStr {
@@ -1484,19 +1478,19 @@ impl Symbol {
14841478
14851479impl fmt:: Debug for Symbol {
14861480 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)
14881482 }
14891483}
14901484
14911485impl fmt:: Display for Symbol {
14921486 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)
14941488 }
14951489}
14961490
14971491impl < S : Encoder > Encodable < S > for Symbol {
14981492 fn encode ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
1499- self . with ( |string| s. emit_str ( string ) )
1493+ s. emit_str ( & self . as_str ( ) )
15001494 }
15011495}
15021496
0 commit comments