@@ -743,7 +743,7 @@ impl Debug for BorrowError {
743743 let mut builder = f. debug_struct ( "BorrowError" ) ;
744744
745745 #[ cfg( feature = "debug_refcell" ) ]
746- builder. field ( "location" , & format_args ! ( "{}" , self . location) ) ;
746+ builder. field ( "location" , self . location ) ;
747747
748748 builder. finish ( )
749749 }
@@ -767,12 +767,13 @@ pub struct BorrowMutError {
767767#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
768768impl Debug for BorrowMutError {
769769 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
770- let mut builder = f. debug_struct ( "BorrowMutError" ) ;
770+ write ! ( f, "{}" , self . location)
771+ // let mut builder = f.debug_struct("BorrowMutError");
771772
772- #[ cfg( feature = "debug_refcell" ) ]
773- builder. field ( "location" , & format_args ! ( "{}" , self . location) ) ;
773+ // #[cfg(feature = "debug_refcell")]
774+ // builder.field("location", self.location);
774775
775- builder. finish ( )
776+ // builder.finish()
776777 }
777778}
778779
@@ -787,23 +788,23 @@ impl Display for BorrowMutError {
787788#[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) ) ]
788789#[ track_caller]
789790#[ cold]
790- fn panic_already_borrowed ( _err : BorrowMutError ) -> ! {
791+ fn panic_already_borrowed ( err : BorrowMutError ) -> ! {
791792 if cfg ! ( feature = "debug_refcell" ) {
792- panic ! ( "cannot borrow as mutable because it is also borrowed as immutable here {:?}" , _err ) ;
793+ panic ! ( "already borrowed here: {:?}" , err ) ;
793794 } else {
794- panic ! ( "cannot borrow as mutable because it is also borrowed as immutable " ) ;
795+ panic ! ( "already borrowed" ) ;
795796 }
796797}
797798
798799// This ensures the panicking code is outlined from `borrow` for `RefCell`.
799800#[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) ) ]
800801#[ track_caller]
801802#[ cold]
802- fn panic_already_mutably_borrowed ( _err : BorrowError ) -> ! {
803+ fn panic_already_mutably_borrowed ( err : BorrowError ) -> ! {
803804 if cfg ! ( feature = "debug_refcell" ) {
804- panic ! ( "cannot borrow as immutable because it is also borrowed as mutable here {:?}" , _err ) ;
805+ panic ! ( "already mutably borrowed here: {:?}" , err ) ;
805806 } else {
806- panic ! ( "cannot borrow as immutable because it is also borrowed as mutable " ) ;
807+ panic ! ( "already mutably borrowed" ) ;
807808 }
808809}
809810
0 commit comments