@@ -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,22 +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
- write ! ( f, "{}" , self . location)
771
- // let mut builder = f.debug_struct("BorrowMutError");
772
-
773
- // #[cfg(feature = "debug_refcell")]
774
- // builder.field("location", self.location);
775
-
776
- // builder.finish()
777
- }
754
+ _location : & ' static crate :: panic:: Location < ' static > ,
778
755
}
779
756
780
757
#[ stable( feature = "try_borrow" , since = "1.13.0" ) ]
@@ -1045,7 +1022,7 @@ impl<T: ?Sized> RefCell<T> {
1045
1022
// If a borrow occurred, then we must already have an outstanding borrow,
1046
1023
// so `borrowed_at` will be `Some`
1047
1024
#[ cfg( feature = "debug_refcell" ) ]
1048
- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1025
+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
1049
1026
} ) ,
1050
1027
}
1051
1028
}
@@ -1134,7 +1111,7 @@ impl<T: ?Sized> RefCell<T> {
1134
1111
// If a borrow occurred, then we must already have an outstanding borrow,
1135
1112
// so `borrowed_at` will be `Some`
1136
1113
#[ cfg( feature = "debug_refcell" ) ]
1137
- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1114
+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
1138
1115
} ) ,
1139
1116
}
1140
1117
}
@@ -1264,7 +1241,7 @@ impl<T: ?Sized> RefCell<T> {
1264
1241
// If a borrow occurred, then we must already have an outstanding borrow,
1265
1242
// so `borrowed_at` will be `Some`
1266
1243
#[ cfg( feature = "debug_refcell" ) ]
1267
- location : self . borrowed_at . get ( ) . unwrap ( ) ,
1244
+ _location : self . borrowed_at . get ( ) . unwrap ( ) ,
1268
1245
} )
1269
1246
}
1270
1247
}
0 commit comments