From 012ff15c94ff44f45c07641bdd0957da6a625591 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Tue, 12 Jul 2016 16:10:01 -0400 Subject: [PATCH] Fix up some tidy-unfriendly spacing --- src/librustc_errors/emitter.rs | 10 ++++-- src/libsyntax/codemap.rs | 36 +++++++++---------- .../ui/mismatched_types/issue-26480.stderr | 4 +-- src/test/ui/mismatched_types/main.stderr | 4 +-- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 901cd3403c1d..8a5aea853f1c 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -534,7 +534,7 @@ impl EmitterWriter { // Put in the spacer between the location and annotated source let buffer_msg_line_offset = buffer.num_lines(); - draw_col_separator(&mut buffer, buffer_msg_line_offset, max_line_num_len + 1); + draw_col_separator_no_space(&mut buffer, buffer_msg_line_offset, max_line_num_len + 1); // Next, output the annotate source for this file for line_idx in 0..annotated_file.lines.len() { @@ -636,7 +636,7 @@ impl EmitterWriter { Ok(()) => { if !db.children.is_empty() { let mut buffer = StyledBuffer::new(); - draw_col_separator(&mut buffer, 0, max_line_num_len + 1); + draw_col_separator_no_space(&mut buffer, 0, max_line_num_len + 1); match emit_to_destination(&buffer.render(), &db.level, &mut self.dst) { Ok(()) => (), Err(e) => panic!("failed to emit error: {}", e) @@ -948,6 +948,10 @@ fn draw_col_separator(buffer: &mut StyledBuffer, line: usize, col: usize) { buffer.puts(line, col, "| ", Style::LineNumber); } +fn draw_col_separator_no_space(buffer: &mut StyledBuffer, line: usize, col: usize) { + buffer.puts(line, col, "|", Style::LineNumber); +} + fn draw_note_separator(buffer: &mut StyledBuffer, line: usize, col: usize) { buffer.puts(line, col, "= ", Style::LineNumber); } @@ -1087,4 +1091,4 @@ impl Write for Destination { Raw(ref mut w) => w.flush(), } } -} +} \ No newline at end of file diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 80b38a8e48ef..9f8e08e06121 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -1265,7 +1265,7 @@ r"blork2.rs:2:1: 2:12 println!("r#\"\n{}\"#", str); assert_eq!(str, &r#" --> dummy.txt:11:1 - | + | 11 | e-lä-vän | ^ "#[1..]); @@ -1333,7 +1333,7 @@ r"blork2.rs:2:1: 2:12 let expect_start = &r#" --> dummy.txt:1:6 - | + | 1 | _____aaaaaa____bbbbbb__cccccdd_ | ^^^^^^ ^^^^^^ ^^^^^^^ "#[1..]; @@ -1409,7 +1409,7 @@ r"blork2.rs:2:1: 2:12 let expect0 = &r#" --> dummy.txt:5:1 - | + | 5 | ccccc | ^ ... @@ -1422,7 +1422,7 @@ r"blork2.rs:2:1: 2:12 let expect = &r#" --> dummy.txt:1:1 - | + | 1 | aaaaa | ^ ... @@ -1477,7 +1477,7 @@ fn foo() { let text = make_string(&lines); assert_eq!(&text[..], &" --> foo.rs:3:2 - | + | 3 | \tbar; | \t^^^ "[1..]); @@ -1510,7 +1510,7 @@ fn foo() { println!("text=\n{}", text); assert_eq!(&text[..], &r#" ::: foo.rs - | + | 3 | vec.push(vec.pop().unwrap()); | --- --- - previous borrow ends here | | | @@ -1580,14 +1580,14 @@ fn bar() { // Note that the `|` remain aligned across both files: assert_eq!(&text[..], &r#" --> foo.rs:3:14 - | + | 3 | vec.push(vec.pop().unwrap()); | --- ^^^ - c | | | | | b | a ::: bar.rs - | + | 17 | vec.push(); | --- - f | | @@ -1632,7 +1632,7 @@ fn foo() { println!("text=\n{}", text); assert_eq!(&text[..], &r#" ::: foo.rs - | + | 3 | let name = find_id(&data, 22).unwrap(); | ---- immutable borrow begins here ... @@ -1672,7 +1672,7 @@ fn foo() { println!("text=r#\"\n{}\".trim_left()", text); assert_eq!(&text[..], &r#" ::: foo.rs - | + | 3 | vec.push(vec.pop().unwrap()); | -------- ------ D | || @@ -1709,7 +1709,7 @@ fn foo() { println!("text=r#\"\n{}\".trim_left()", text); assert_eq!(&text[..], &r#" ::: foo.rs - | + | 3 | vec.push(vec.pop().unwrap()); | --- --- - previous borrow ends here | | | @@ -1748,7 +1748,7 @@ fn foo() { println!("text=r#\"\n{}\".trim_left()", text); assert_eq!(&text[..], &r#" ::: foo.rs - | + | 4 | let mut vec2 = vec; | --- `vec` moved here because it has type `collections::vec::Vec` ... @@ -1785,7 +1785,7 @@ fn foo() { println!("text=&r#\"\n{}\n\"#[1..]", text); assert_eq!(text, &r#" ::: foo.rs - | + | 3 | let mut vec = vec![0, 1, 2]; | --- --- 4 | let mut vec2 = vec; @@ -1817,7 +1817,7 @@ impl SomeTrait for () { println!("r#\"\n{}\"", text); assert_eq!(text, &r#" ::: foo.rs - | + | 3 | fn foo(x: u32) { | - "#[1..]); @@ -1847,7 +1847,7 @@ impl SomeTrait for () { println!("r#\"\n{}\"", text); assert_eq!(text, &r#" ::: foo.rs - | + | 2 | fn foo(x: u32) { | -------------- | | | @@ -1882,7 +1882,7 @@ impl SomeTrait for () { println!("r#\"\n{}\"", text); assert_eq!(text, &r#" ::: foo.rs - | + | 2 | fn foo(x: u32) { | -------------- | | | @@ -1928,7 +1928,7 @@ impl SomeTrait for () { println!("r#\"\n{}\"", text); assert_eq!(text, &r#" ::: foo.rs - | + | 3 | let closure = || { | - foo 4 | inner @@ -1971,7 +1971,7 @@ fn main() { println!("r#\"\n{}\"", text); assert_eq!(text, &r#" --> foo.rs:11:2 - | + | 11 | } | - "#[1..]); diff --git a/src/test/ui/mismatched_types/issue-26480.stderr b/src/test/ui/mismatched_types/issue-26480.stderr index 63f2ab4d7c6b..ff6920d28ccf 100644 --- a/src/test/ui/mismatched_types/issue-26480.stderr +++ b/src/test/ui/mismatched_types/issue-26480.stderr @@ -1,13 +1,13 @@ error[E0308]: mismatched types --> $DIR/issue-26480.rs:27:19 - | + | 27 | $arr.len() * size_of($arr[0])); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize $DIR/issue-26480.rs:38:5: 38:19 note: in this expansion of write! (defined in $DIR/issue-26480.rs) error: non-scalar cast: `_` as `()` --> $DIR/issue-26480.rs:33:19 - | + | 33 | ($x:expr) => ($x as ()) | ^^^^^^^^ $DIR/issue-26480.rs:39:5: 39:14 note: in this expansion of cast! (defined in $DIR/issue-26480.rs) diff --git a/src/test/ui/mismatched_types/main.stderr b/src/test/ui/mismatched_types/main.stderr index ae1d417eca9e..2903aa08c0a9 100644 --- a/src/test/ui/mismatched_types/main.stderr +++ b/src/test/ui/mismatched_types/main.stderr @@ -1,9 +1,9 @@ error[E0308]: mismatched types --> $DIR/main.rs:14:18 - | + | 14 | let x: u32 = ( | ^ expected u32, found () - | + | = note: expected type `u32` = note: found type `()`