@@ -90,7 +90,6 @@ pub enum Style {
90
90
LabelSecondary ,
91
91
NoStyle ,
92
92
}
93
- use self :: Style :: * ;
94
93
95
94
#[ derive( Debug , Clone ) ]
96
95
pub enum RenderedLineKind {
@@ -247,19 +246,19 @@ impl RenderedLineKind {
247
246
RLK :: SourceText { file : _, line_index } =>
248
247
StyledString {
249
248
text : format ! ( "{}" , line_index + 1 ) ,
250
- style : LineNumber ,
249
+ style : Style :: LineNumber ,
251
250
} ,
252
251
RLK :: Elision =>
253
252
StyledString {
254
253
text : String :: from ( "..." ) ,
255
- style : LineNumber ,
254
+ style : Style :: LineNumber ,
256
255
} ,
257
256
RLK :: PrimaryFileName |
258
257
RLK :: OtherFileName |
259
258
RLK :: Annotations =>
260
259
StyledString {
261
260
text : String :: from ( "" ) ,
262
- style : LineNumber ,
261
+ style : Style :: LineNumber ,
263
262
} ,
264
263
}
265
264
}
@@ -275,7 +274,7 @@ impl StyledBuffer {
275
274
let mut styled_vec: Vec < StyledString > = vec ! [ ] ;
276
275
277
276
for ( row, row_style) in self . text . iter ( ) . zip ( & self . styles ) {
278
- let mut current_style = NoStyle ;
277
+ let mut current_style = Style :: NoStyle ;
279
278
let mut current_text = String :: new ( ) ;
280
279
281
280
for ( & c, & s) in row. iter ( ) . zip ( row_style) {
@@ -316,7 +315,7 @@ impl StyledBuffer {
316
315
} else {
317
316
while self . text [ line] . len ( ) < col {
318
317
self . text [ line] . push ( ' ' ) ;
319
- self . styles [ line] . push ( NoStyle ) ;
318
+ self . styles [ line] . push ( Style :: NoStyle ) ;
320
319
}
321
320
self . text [ line] . push ( chr) ;
322
321
self . styles [ line] . push ( style) ;
@@ -479,10 +478,10 @@ impl FileInfo {
479
478
output. push ( RenderedLine {
480
479
text : vec ! [ StyledString {
481
480
text: lo. file. name. clone( ) ,
482
- style: FileNameStyle ,
481
+ style: Style :: FileNameStyle ,
483
482
} , StyledString {
484
483
text: format!( ":{}:{}" , lo. line, lo. col. 0 + 1 ) ,
485
- style: LineAndColumn ,
484
+ style: Style :: LineAndColumn ,
486
485
} ] ,
487
486
kind : RLK :: PrimaryFileName ,
488
487
} ) ;
@@ -491,7 +490,7 @@ impl FileInfo {
491
490
output. push ( RenderedLine {
492
491
text : vec ! [ StyledString {
493
492
text: self . file. name. clone( ) ,
494
- style: FileNameStyle ,
493
+ style: Style :: FileNameStyle ,
495
494
} ] ,
496
495
kind : RLK :: OtherFileName ,
497
496
} ) ;
@@ -534,7 +533,7 @@ impl FileInfo {
534
533
if prev_ends_at_eol && is_single_unlabeled_annotated_line {
535
534
if !elide_unlabeled_region {
536
535
output. push ( RenderedLine :: from ( ( String :: new ( ) ,
537
- NoStyle , RLK :: Elision ) ) ) ;
536
+ Style :: NoStyle , RLK :: Elision ) ) ) ;
538
537
elide_unlabeled_region = true ;
539
538
prev_ends_at_eol = true ;
540
539
}
@@ -548,7 +547,7 @@ impl FileInfo {
548
547
}
549
548
} else {
550
549
if group. len ( ) > 1 {
551
- output. push ( RenderedLine :: from ( ( String :: new ( ) , NoStyle , RLK :: Elision ) ) ) ;
550
+ output. push ( RenderedLine :: from ( ( String :: new ( ) , Style :: NoStyle , RLK :: Elision ) ) ) ;
552
551
} else {
553
552
let mut v: Vec < RenderedLine > =
554
553
group. iter ( ) . flat_map ( |line| self . render_line ( line) ) . collect ( ) ;
@@ -571,7 +570,7 @@ impl FileInfo {
571
570
let mut styled_buffer = StyledBuffer :: new ( ) ;
572
571
573
572
// First create the source line we will highlight.
574
- styled_buffer. append ( 0 , & source_string, Quotation ) ;
573
+ styled_buffer. append ( 0 , & source_string, Style :: Quotation ) ;
575
574
576
575
if line. annotations . is_empty ( ) {
577
576
return styled_buffer. render ( source_kind) ;
@@ -606,10 +605,10 @@ impl FileInfo {
606
605
for annotation in & annotations {
607
606
for p in annotation. start_col .. annotation. end_col {
608
607
if annotation. is_primary {
609
- styled_buffer. putc ( 1 , p, '^' , UnderlinePrimary ) ;
610
- styled_buffer. set_style ( 0 , p, UnderlinePrimary ) ;
608
+ styled_buffer. putc ( 1 , p, '^' , Style :: UnderlinePrimary ) ;
609
+ styled_buffer. set_style ( 0 , p, Style :: UnderlinePrimary ) ;
611
610
} else {
612
- styled_buffer. putc ( 1 , p, '-' , UnderlineSecondary ) ;
611
+ styled_buffer. putc ( 1 , p, '-' , Style :: UnderlineSecondary ) ;
613
612
}
614
613
}
615
614
}
@@ -671,9 +670,9 @@ impl FileInfo {
671
670
// string
672
671
let highlight_label: String = format ! ( " {}" , last. label. as_ref( ) . unwrap( ) ) ;
673
672
if last. is_primary {
674
- styled_buffer. append ( 1 , & highlight_label, LabelPrimary ) ;
673
+ styled_buffer. append ( 1 , & highlight_label, Style :: LabelPrimary ) ;
675
674
} else {
676
- styled_buffer. append ( 1 , & highlight_label, LabelSecondary ) ;
675
+ styled_buffer. append ( 1 , & highlight_label, Style :: LabelSecondary ) ;
677
676
}
678
677
labeled_annotations = previous;
679
678
}
@@ -696,18 +695,18 @@ impl FileInfo {
696
695
// text ought to be long enough for this.
697
696
for index in 2 ..blank_lines {
698
697
if annotation. is_primary {
699
- styled_buffer. putc ( index, annotation. start_col , '|' , UnderlinePrimary ) ;
698
+ styled_buffer. putc ( index, annotation. start_col , '|' , Style :: UnderlinePrimary ) ;
700
699
} else {
701
- styled_buffer. putc ( index, annotation. start_col , '|' , UnderlineSecondary ) ;
700
+ styled_buffer. putc ( index, annotation. start_col , '|' , Style :: UnderlineSecondary ) ;
702
701
}
703
702
}
704
703
705
704
if annotation. is_primary {
706
705
styled_buffer. puts ( blank_lines, annotation. start_col ,
707
- annotation. label . as_ref ( ) . unwrap ( ) , LabelPrimary ) ;
706
+ annotation. label . as_ref ( ) . unwrap ( ) , Style :: LabelPrimary ) ;
708
707
} else {
709
708
styled_buffer. puts ( blank_lines, annotation. start_col ,
710
- annotation. label . as_ref ( ) . unwrap ( ) , LabelSecondary ) ;
709
+ annotation. label . as_ref ( ) . unwrap ( ) , Style :: LabelSecondary ) ;
711
710
}
712
711
}
713
712
@@ -752,7 +751,7 @@ fn prepend_prefixes(rendered_lines: &mut [RenderedLine]) {
752
751
. chain ( Some ( '>' ) )
753
752
. chain ( Some ( ' ' ) ) ;
754
753
line. text . insert ( 0 , StyledString { text : dashes. collect ( ) ,
755
- style : LineNumber } )
754
+ style : Style :: LineNumber } )
756
755
}
757
756
RenderedLineKind :: OtherFileName => {
758
757
// >>>>> filename
@@ -762,12 +761,12 @@ fn prepend_prefixes(rendered_lines: &mut [RenderedLine]) {
762
761
let dashes = ( 0 ..padding_len + 2 ) . map ( |_| '>' )
763
762
. chain ( Some ( ' ' ) ) ;
764
763
line. text . insert ( 0 , StyledString { text : dashes. collect ( ) ,
765
- style : LineNumber } )
764
+ style : Style :: LineNumber } )
766
765
}
767
766
_ => {
768
767
line. text . insert ( 0 , prefix) ;
769
768
line. text . insert ( 1 , StyledString { text : String :: from ( "|> " ) ,
770
- style : LineNumber } )
769
+ style : Style :: LineNumber } )
771
770
}
772
771
}
773
772
}
0 commit comments