Skip to content

Commit d5529f0

Browse files
committed
Nit: do not use RLK
1 parent d58a4be commit d5529f0

File tree

1 file changed

+14
-12
lines changed
  • src/libsyntax/errors/snippet

1 file changed

+14
-12
lines changed

src/libsyntax/errors/snippet/mod.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ pub enum RenderedLineKind {
102102
Annotations,
103103
Elision,
104104
}
105-
use self::RenderedLineKind as RLK;
106105

107106
impl SnippetData {
108107
pub fn new(codemap: Rc<CodeMap>,
@@ -243,19 +242,19 @@ impl RenderedLine {
243242
impl RenderedLineKind {
244243
fn prefix(&self) -> StyledString {
245244
match *self {
246-
RLK::SourceText { file: _, line_index } =>
245+
RenderedLineKind::SourceText { file: _, line_index } =>
247246
StyledString {
248247
text: format!("{}", line_index + 1),
249248
style: Style::LineNumber,
250249
},
251-
RLK::Elision =>
250+
RenderedLineKind::Elision =>
252251
StyledString {
253252
text: String::from("..."),
254253
style: Style::LineNumber,
255254
},
256-
RLK::PrimaryFileName |
257-
RLK::OtherFileName |
258-
RLK::Annotations =>
255+
RenderedLineKind::PrimaryFileName |
256+
RenderedLineKind::OtherFileName |
257+
RenderedLineKind::Annotations =>
259258
StyledString {
260259
text: String::from(""),
261260
style: Style::LineNumber,
@@ -295,7 +294,7 @@ impl StyledBuffer {
295294
//We know our first output line is source and the rest are highlights and labels
296295
output.push(RenderedLine { text: styled_vec, kind: source_kind.clone() });
297296
} else {
298-
output.push(RenderedLine { text: styled_vec, kind: RLK::Annotations });
297+
output.push(RenderedLine { text: styled_vec, kind: RenderedLineKind::Annotations });
299298
}
300299
styled_vec = vec![];
301300
}
@@ -483,7 +482,7 @@ impl FileInfo {
483482
text: format!(":{}:{}", lo.line, lo.col.0 + 1),
484483
style: Style::LineAndColumn,
485484
}],
486-
kind: RLK::PrimaryFileName,
485+
kind: RenderedLineKind::PrimaryFileName,
487486
});
488487
}
489488
None => {
@@ -492,7 +491,7 @@ impl FileInfo {
492491
text: self.file.name.clone(),
493492
style: Style::FileNameStyle,
494493
}],
495-
kind: RLK::OtherFileName,
494+
kind: RenderedLineKind::OtherFileName,
496495
});
497496
}
498497
}
@@ -533,7 +532,8 @@ impl FileInfo {
533532
if prev_ends_at_eol && is_single_unlabeled_annotated_line {
534533
if !elide_unlabeled_region {
535534
output.push(RenderedLine::from((String::new(),
536-
Style::NoStyle, RLK::Elision)));
535+
Style::NoStyle,
536+
RenderedLineKind::Elision)));
537537
elide_unlabeled_region = true;
538538
prev_ends_at_eol = true;
539539
}
@@ -547,7 +547,9 @@ impl FileInfo {
547547
}
548548
} else {
549549
if group.len() > 1 {
550-
output.push(RenderedLine::from((String::new(), Style::NoStyle, RLK::Elision)));
550+
output.push(RenderedLine::from((String::new(),
551+
Style::NoStyle,
552+
RenderedLineKind::Elision)));
551553
} else {
552554
let mut v: Vec<RenderedLine> =
553555
group.iter().flat_map(|line| self.render_line(line)).collect();
@@ -562,7 +564,7 @@ impl FileInfo {
562564
fn render_line(&self, line: &Line) -> Vec<RenderedLine> {
563565
let source_string = self.file.get_line(line.line_index)
564566
.unwrap_or("");
565-
let source_kind = RLK::SourceText {
567+
let source_kind = RenderedLineKind::SourceText {
566568
file: self.file.clone(),
567569
line_index: line.line_index,
568570
};

0 commit comments

Comments
 (0)