Skip to content

Commit 0cefc8d

Browse files
committed
---
yaml --- r: 277933 b: refs/heads/auto c: d58a4be h: refs/heads/master i: 277931: 87a5be4
1 parent 769a1ba commit 0cefc8d

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: e56121c584893d8b46af5e4cd5d580d30f221d9f
11+
refs/heads/auto: d58a4becf3943c02b9815f3d3875fe8817e41c7b
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/libsyntax/errors/snippet/mod.rs

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ pub enum Style {
9090
LabelSecondary,
9191
NoStyle,
9292
}
93-
use self::Style::*;
9493

9594
#[derive(Debug, Clone)]
9695
pub enum RenderedLineKind {
@@ -247,19 +246,19 @@ impl RenderedLineKind {
247246
RLK::SourceText { file: _, line_index } =>
248247
StyledString {
249248
text: format!("{}", line_index + 1),
250-
style: LineNumber,
249+
style: Style::LineNumber,
251250
},
252251
RLK::Elision =>
253252
StyledString {
254253
text: String::from("..."),
255-
style: LineNumber,
254+
style: Style::LineNumber,
256255
},
257256
RLK::PrimaryFileName |
258257
RLK::OtherFileName |
259258
RLK::Annotations =>
260259
StyledString {
261260
text: String::from(""),
262-
style: LineNumber,
261+
style: Style::LineNumber,
263262
},
264263
}
265264
}
@@ -275,7 +274,7 @@ impl StyledBuffer {
275274
let mut styled_vec: Vec<StyledString> = vec![];
276275

277276
for (row, row_style) in self.text.iter().zip(&self.styles) {
278-
let mut current_style = NoStyle;
277+
let mut current_style = Style::NoStyle;
279278
let mut current_text = String::new();
280279

281280
for (&c, &s) in row.iter().zip(row_style) {
@@ -316,7 +315,7 @@ impl StyledBuffer {
316315
} else {
317316
while self.text[line].len() < col {
318317
self.text[line].push(' ');
319-
self.styles[line].push(NoStyle);
318+
self.styles[line].push(Style::NoStyle);
320319
}
321320
self.text[line].push(chr);
322321
self.styles[line].push(style);
@@ -479,10 +478,10 @@ impl FileInfo {
479478
output.push(RenderedLine {
480479
text: vec![StyledString {
481480
text: lo.file.name.clone(),
482-
style: FileNameStyle,
481+
style: Style::FileNameStyle,
483482
}, StyledString {
484483
text: format!(":{}:{}", lo.line, lo.col.0 + 1),
485-
style: LineAndColumn,
484+
style: Style::LineAndColumn,
486485
}],
487486
kind: RLK::PrimaryFileName,
488487
});
@@ -491,7 +490,7 @@ impl FileInfo {
491490
output.push(RenderedLine {
492491
text: vec![StyledString {
493492
text: self.file.name.clone(),
494-
style: FileNameStyle,
493+
style: Style::FileNameStyle,
495494
}],
496495
kind: RLK::OtherFileName,
497496
});
@@ -534,7 +533,7 @@ impl FileInfo {
534533
if prev_ends_at_eol && is_single_unlabeled_annotated_line {
535534
if !elide_unlabeled_region {
536535
output.push(RenderedLine::from((String::new(),
537-
NoStyle, RLK::Elision)));
536+
Style::NoStyle, RLK::Elision)));
538537
elide_unlabeled_region = true;
539538
prev_ends_at_eol = true;
540539
}
@@ -548,7 +547,7 @@ impl FileInfo {
548547
}
549548
} else {
550549
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)));
552551
} else {
553552
let mut v: Vec<RenderedLine> =
554553
group.iter().flat_map(|line| self.render_line(line)).collect();
@@ -571,7 +570,7 @@ impl FileInfo {
571570
let mut styled_buffer = StyledBuffer::new();
572571

573572
// 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);
575574

576575
if line.annotations.is_empty() {
577576
return styled_buffer.render(source_kind);
@@ -606,10 +605,10 @@ impl FileInfo {
606605
for annotation in &annotations {
607606
for p in annotation.start_col .. annotation.end_col {
608607
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);
611610
} else {
612-
styled_buffer.putc(1, p, '-', UnderlineSecondary);
611+
styled_buffer.putc(1, p, '-', Style::UnderlineSecondary);
613612
}
614613
}
615614
}
@@ -671,9 +670,9 @@ impl FileInfo {
671670
// string
672671
let highlight_label: String = format!(" {}", last.label.as_ref().unwrap());
673672
if last.is_primary {
674-
styled_buffer.append(1, &highlight_label, LabelPrimary);
673+
styled_buffer.append(1, &highlight_label, Style::LabelPrimary);
675674
} else {
676-
styled_buffer.append(1, &highlight_label, LabelSecondary);
675+
styled_buffer.append(1, &highlight_label, Style::LabelSecondary);
677676
}
678677
labeled_annotations = previous;
679678
}
@@ -696,18 +695,18 @@ impl FileInfo {
696695
// text ought to be long enough for this.
697696
for index in 2..blank_lines {
698697
if annotation.is_primary {
699-
styled_buffer.putc(index, annotation.start_col, '|', UnderlinePrimary);
698+
styled_buffer.putc(index, annotation.start_col, '|', Style::UnderlinePrimary);
700699
} else {
701-
styled_buffer.putc(index, annotation.start_col, '|', UnderlineSecondary);
700+
styled_buffer.putc(index, annotation.start_col, '|', Style::UnderlineSecondary);
702701
}
703702
}
704703

705704
if annotation.is_primary {
706705
styled_buffer.puts(blank_lines, annotation.start_col,
707-
annotation.label.as_ref().unwrap(), LabelPrimary);
706+
annotation.label.as_ref().unwrap(), Style::LabelPrimary);
708707
} else {
709708
styled_buffer.puts(blank_lines, annotation.start_col,
710-
annotation.label.as_ref().unwrap(), LabelSecondary);
709+
annotation.label.as_ref().unwrap(), Style::LabelSecondary);
711710
}
712711
}
713712

@@ -752,7 +751,7 @@ fn prepend_prefixes(rendered_lines: &mut [RenderedLine]) {
752751
.chain(Some('>'))
753752
.chain(Some(' '));
754753
line.text.insert(0, StyledString {text: dashes.collect(),
755-
style: LineNumber})
754+
style: Style::LineNumber})
756755
}
757756
RenderedLineKind::OtherFileName => {
758757
// >>>>> filename
@@ -762,12 +761,12 @@ fn prepend_prefixes(rendered_lines: &mut [RenderedLine]) {
762761
let dashes = (0..padding_len + 2).map(|_| '>')
763762
.chain(Some(' '));
764763
line.text.insert(0, StyledString {text: dashes.collect(),
765-
style: LineNumber})
764+
style: Style::LineNumber})
766765
}
767766
_ => {
768767
line.text.insert(0, prefix);
769768
line.text.insert(1, StyledString {text: String::from("|> "),
770-
style: LineNumber})
769+
style: Style::LineNumber})
771770
}
772771
}
773772
}

0 commit comments

Comments
 (0)