File tree 2 files changed +47
-2
lines changed
2 files changed +47
-2
lines changed Original file line number Diff line number Diff line change @@ -450,9 +450,20 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
450
450
fn print_comment ( & mut self , cmnt : & comments:: Comment ) {
451
451
match cmnt. style {
452
452
comments:: Mixed => {
453
- assert_eq ! ( cmnt. lines. len( ) , 1 ) ;
454
453
self . zerobreak ( ) ;
455
- self . word ( cmnt. lines [ 0 ] . clone ( ) ) ;
454
+ if let Some ( ( last, lines) ) = cmnt. lines . split_last ( ) {
455
+ self . ibox ( 0 ) ;
456
+
457
+ for line in lines {
458
+ self . word ( line. clone ( ) ) ;
459
+ self . hardbreak ( )
460
+ }
461
+
462
+ self . word ( last. clone ( ) ) ;
463
+ self . space ( ) ;
464
+
465
+ self . end ( ) ;
466
+ }
456
467
self . zerobreak ( )
457
468
}
458
469
comments:: Isolated => {
Original file line number Diff line number Diff line change
1
+ fn main ( /*
2
+ ---
3
+ */ ) {
4
+ let x /* this is one line */ = 3 ;
5
+
6
+ let x /*
7
+ * this
8
+ * is
9
+ * multiple
10
+ * lines
11
+ */ = 3 ;
12
+
13
+ let x = /*
14
+ * this
15
+ * is
16
+ * multiple
17
+ * lines
18
+ * after
19
+ * the
20
+ * =
21
+ */ 3 ;
22
+
23
+ let x /*
24
+ * this
25
+ * is
26
+ * multiple
27
+ * lines
28
+ * including
29
+ * a
30
+
31
+ * blank
32
+ * line
33
+ */ = 3 ;
34
+ }
You can’t perform that action at this time.
0 commit comments