@@ -743,7 +743,7 @@ impl Debug for BorrowError {
743
743
let mut builder = f. debug_struct ( "BorrowError" ) ;
744
744
745
745
#[ cfg( feature = "debug_refcell" ) ]
746
- builder. field ( "location" , & format_args ! ( "{}" , self . location) ) ;
746
+ builder. field ( "location" , self . location ) ;
747
747
748
748
builder. finish ( )
749
749
}
@@ -767,12 +767,13 @@ pub struct BorrowMutError {
767
767
#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
768
768
impl Debug for BorrowMutError {
769
769
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");
771
772
772
- #[ cfg( feature = "debug_refcell" ) ]
773
- builder. field ( "location" , & format_args ! ( "{}" , self . location) ) ;
773
+ // #[cfg(feature = "debug_refcell")]
774
+ // builder.field("location", self.location);
774
775
775
- builder. finish ( )
776
+ // builder.finish()
776
777
}
777
778
}
778
779
@@ -787,23 +788,23 @@ impl Display for BorrowMutError {
787
788
#[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) ) ]
788
789
#[ track_caller]
789
790
#[ cold]
790
- fn panic_already_borrowed ( _err : BorrowMutError ) -> ! {
791
+ fn panic_already_borrowed ( err : BorrowMutError ) -> ! {
791
792
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 ) ;
793
794
} else {
794
- panic ! ( "cannot borrow as mutable because it is also borrowed as immutable " ) ;
795
+ panic ! ( "already borrowed" ) ;
795
796
}
796
797
}
797
798
798
799
// This ensures the panicking code is outlined from `borrow` for `RefCell`.
799
800
#[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) ) ]
800
801
#[ track_caller]
801
802
#[ cold]
802
- fn panic_already_mutably_borrowed ( _err : BorrowError ) -> ! {
803
+ fn panic_already_mutably_borrowed ( err : BorrowError ) -> ! {
803
804
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 ) ;
805
806
} else {
806
- panic ! ( "cannot borrow as immutable because it is also borrowed as mutable " ) ;
807
+ panic ! ( "already mutably borrowed" ) ;
807
808
}
808
809
}
809
810
0 commit comments