@@ -732,21 +732,10 @@ pub struct RefCell<T: ?Sized> {
732
732
/// An error returned by [`RefCell::try_borrow`].
733
733
#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
734
734
#[ non_exhaustive]
735
+ #[ derive( Debug ) ]
735
736
pub struct BorrowError {
736
737
#[ cfg( feature = "debug_refcell" ) ]
737
- location : & ' static crate :: panic:: Location < ' static > ,
738
- }
739
-
740
- #[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
741
- impl Debug for BorrowError {
742
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
743
- let mut builder = f. debug_struct ( "BorrowError" ) ;
744
-
745
- #[ cfg( feature = "debug_refcell" ) ]
746
- builder. field ( "location" , self . location ) ;
747
-
748
- builder. finish ( )
749
- }
738
+ _location : & ' static crate :: panic:: Location < ' static > ,
750
739
}
751
740
752
741
#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
@@ -759,21 +748,10 @@ impl Display for BorrowError {
759
748
/// An error returned by [`RefCell::try_borrow_mut`].
760
749
#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
761
750
#[ non_exhaustive]
751
+ #[ derive( Debug ) ]
762
752
pub struct BorrowMutError {
763
753
#[ cfg( feature = "debug_refcell" ) ]
764
- location : & ' static crate :: panic:: Location < ' static > ,
765
- }
766
-
767
- #[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
768
- impl Debug for BorrowMutError {
769
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
770
- let mut builder = f. debug_struct ( "BorrowMutError" ) ;
771
-
772
- #[ cfg( feature = "debug_refcell" ) ]
773
- builder. field ( "location" , self . location ) ;
774
-
775
- builder. finish ( )
776
- }
754
+ _location : & ' static crate :: panic:: Location < ' static > ,
777
755
}
778
756
779
757
#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
@@ -1036,7 +1014,7 @@ impl<T: ?Sized> RefCell<T> {
1036
1014
// If a borrow occurred, then we must already have an outstanding borrow,
1037
1015
// so `borrowed_at` will be `Some`
1038
1016
#[ cfg( feature = "debug_refcell" ) ]
1039
- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1017
+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
1040
1018
} ) ,
1041
1019
}
1042
1020
}
@@ -1125,7 +1103,7 @@ impl<T: ?Sized> RefCell<T> {
1125
1103
// If a borrow occurred, then we must already have an outstanding borrow,
1126
1104
// so `borrowed_at` will be `Some`
1127
1105
#[ cfg( feature = "debug_refcell" ) ]
1128
- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1106
+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
1129
1107
} ) ,
1130
1108
}
1131
1109
}
@@ -1255,7 +1233,7 @@ impl<T: ?Sized> RefCell<T> {
1255
1233
// If a borrow occurred, then we must already have an outstanding borrow,
1256
1234
// so `borrowed_at` will be `Some`
1257
1235
#[ cfg( feature = "debug_refcell" ) ]
1258
- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1236
+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
1259
1237
} )
1260
1238
}
1261
1239
}
0 commit comments