about summary refs log tree commit diff
path: root/src/libsyntax/errors/snippet/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/errors/snippet/mod.rs')
-rw-r--r--src/libsyntax/errors/snippet/mod.rs17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/libsyntax/errors/snippet/mod.rs b/src/libsyntax/errors/snippet/mod.rs
index 18a64cc399c..6c90bfd0818 100644
--- a/src/libsyntax/errors/snippet/mod.rs
+++ b/src/libsyntax/errors/snippet/mod.rs
@@ -11,6 +11,7 @@
 // Code for annotating snippets.
 
 use codemap::{CharPos, CodeMap, FileMap, LineInfo, Span};
+use errors::check_old_skool;
 use std::cmp;
 use std::rc::Rc;
 use std::mem;
@@ -432,10 +433,8 @@ impl FileInfo {
     }
 
     fn render_file_lines(&self, codemap: &Rc<CodeMap>) -> Vec<RenderedLine> {
-        let old_school = match ::std::env::var("RUST_NEW_ERROR_FORMAT") {
-            Ok(_) => false,
-            Err(_) => true,
-        };
+        let old_school = check_old_skool();
+
         // As a first step, we elide any instance of more than one
         // continuous unannotated line.
 
@@ -525,10 +524,7 @@ impl FileInfo {
     }
 
     fn render_line(&self, line: &Line) -> Vec<RenderedLine> {
-        let old_school = match ::std::env::var("RUST_NEW_ERROR_FORMAT") {
-            Ok(_) => false,
-            Err(_) => true,
-        };
+        let old_school = check_old_skool();
         let source_string = self.file.get_line(line.line_index)
                                      .unwrap_or("");
         let source_kind = RenderedLineKind::SourceText {
@@ -709,10 +705,7 @@ impl FileInfo {
 }
 
 fn prepend_prefixes(rendered_lines: &mut [RenderedLine]) {
-    let old_school = match ::std::env::var("RUST_NEW_ERROR_FORMAT") {
-        Ok(_) => false,
-        Err(_) => true,
-    };
+    let old_school = check_old_skool();
     if old_school {
         return;
     }