@@ -775,10 +775,10 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
775
775
reason = "recently added" ,
776
776
issue = "62482" ) ]
777
777
pub fn key ( & mut self , key : & dyn fmt:: Debug ) -> & mut DebugMap < ' a , ' b > {
778
- assert ! ( !self . has_key, "attempted to begin a new map entry \
779
- without completing the previous one") ;
780
-
781
778
self . result = self . result . and_then ( |_| {
779
+ assert ! ( !self . has_key, "attempted to begin a new map entry \
780
+ without completing the previous one") ;
781
+
782
782
if self . is_pretty ( ) {
783
783
if !self . has_fields {
784
784
self . fmt . write_str ( "\n " ) ?;
@@ -839,9 +839,9 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
839
839
reason = "recently added" ,
840
840
issue = "62482" ) ]
841
841
pub fn value ( & mut self , value : & dyn fmt:: Debug ) -> & mut DebugMap < ' a , ' b > {
842
- assert ! ( self . has_key, "attempted to format a map value before its key" ) ;
843
-
844
842
self . result = self . result . and_then ( |_| {
843
+ assert ! ( self . has_key, "attempted to format a map value before its key" ) ;
844
+
845
845
if self . is_pretty ( ) {
846
846
let mut slot = None ;
847
847
let mut writer = PadAdapter :: wrap ( & mut self . fmt , & mut slot, & mut self . state ) ;
@@ -924,9 +924,11 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
924
924
/// ```
925
925
#[ stable( feature = "debug_builders" , since = "1.2.0" ) ]
926
926
pub fn finish ( & mut self ) -> fmt:: Result {
927
- assert ! ( !self . has_key, "attempted to finish a map with a partial entry" ) ;
927
+ self . result . and_then ( |_| {
928
+ assert ! ( !self . has_key, "attempted to finish a map with a partial entry" ) ;
928
929
929
- self . result . and_then ( |_| self . fmt . write_str ( "}" ) )
930
+ self . fmt . write_str ( "}" )
931
+ } )
930
932
}
931
933
932
934
fn is_pretty ( & self ) -> bool {
0 commit comments