@@ -546,13 +546,15 @@ impl<'sess> State<'sess, '_> {
546546 // Handle mixed with follow-up comment
547547 if cmnt. style . is_mixed ( ) {
548548 if let Some ( cmnt) = self . peek_comment_before ( pos) {
549- config. mixed_no_break = true ;
549+ config. mixed_no_break_prev = true ;
550+ config. mixed_no_break_post = true ;
550551 config. mixed_post_nbsp = cmnt. style . is_mixed ( ) ;
551552 }
552553
553554 // Ensure consecutive mixed comments don't have a double-space
554555 if last_style. is_some_and ( |s| s. is_mixed ( ) ) {
555- config. mixed_no_break = true ;
556+ config. mixed_no_break_prev = true ;
557+ config. mixed_no_break_post = true ;
556558 config. mixed_prev_space = false ;
557559 }
558560 } else if config. offset != 0
@@ -693,7 +695,7 @@ impl<'sess> State<'sess, '_> {
693695 let Some ( prefix) = cmnt. prefix ( ) else { return } ;
694696 let never_break = self . last_token_is_neverbreak ( ) ;
695697 if !self . is_bol_or_only_ind ( ) {
696- match ( never_break || config. mixed_no_break , config. mixed_prev_space ) {
698+ match ( never_break || config. mixed_no_break_prev , config. mixed_prev_space ) {
697699 ( false , true ) => config. space ( & mut self . s ) ,
698700 ( false , false ) => config. zerobreak ( & mut self . s ) ,
699701 ( true , true ) => self . nbsp ( ) ,
@@ -721,7 +723,7 @@ impl<'sess> State<'sess, '_> {
721723 if config. mixed_post_nbsp {
722724 config. nbsp_or_space ( self . config . wrap_comments , & mut self . s ) ;
723725 self . cursor . advance ( 1 ) ;
724- } else if !config. mixed_no_break {
726+ } else if !config. mixed_no_break_post {
725727 config. space ( & mut self . s ) ;
726728 self . cursor . advance ( 1 ) ;
727729 }
@@ -996,7 +998,8 @@ pub(crate) struct CommentConfig {
996998 // Config: mixed comments
997999 mixed_prev_space : bool ,
9981000 mixed_post_nbsp : bool ,
999- mixed_no_break : bool ,
1001+ mixed_no_break_prev : bool ,
1002+ mixed_no_break_post : bool ,
10001003}
10011004
10021005impl CommentConfig {
@@ -1020,7 +1023,8 @@ impl CommentConfig {
10201023 pub ( crate ) fn no_breaks ( mut self ) -> Self {
10211024 self . iso_no_break = true ;
10221025 self . trailing_no_break = true ;
1023- self . mixed_no_break = true ;
1026+ self . mixed_no_break_prev = true ;
1027+ self . mixed_no_break_post = true ;
10241028 self
10251029 }
10261030
@@ -1030,7 +1034,13 @@ impl CommentConfig {
10301034 }
10311035
10321036 pub ( crate ) fn mixed_no_break ( mut self ) -> Self {
1033- self . mixed_no_break = true ;
1037+ self . mixed_no_break_prev = true ;
1038+ self . mixed_no_break_post = true ;
1039+ self
1040+ }
1041+
1042+ pub ( crate ) fn mixed_no_break_post ( mut self ) -> Self {
1043+ self . mixed_no_break_post = true ;
10341044 self
10351045 }
10361046
0 commit comments