Repository: rust-lang/annotate-snippets-rs
Pull request #179 (2025-02-12 15:34:12)

fix: Remove trailing pipe
rustc doesn't do this and so this is prep for switching to rustc's renderer


Patch:
diff --git a/examples/expected_type.svg b/examples/expected_type.svg
index ed19ef3..d5de44f 100644
--- a/examples/expected_type.svg
+++ b/examples/expected_type.svg
@@ -1,4 +1,4 @@
-<svg width="860px" height="218px" xmlns="http://www.w3.org/2000/svg">
+<svg width="860px" height="200px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -37,9 +37,7 @@
 </tspan>
     <tspan x="10px" y="172px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>                         </tspan><tspan class="fg-bright-red bold">^^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected struct `annotate_snippets::snippet::Slice`, found reference</tspan>
 </tspan>
-    <tspan x="10px" y="190px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan>
-</tspan>
-    <tspan x="10px" y="208px">
+    <tspan x="10px" y="190px">
 </tspan>
   </text>
 
diff --git a/examples/footer.svg b/examples/footer.svg
index 76e7d77..ab9e4df 100644
--- a/examples/footer.svg
+++ b/examples/footer.svg
@@ -1,4 +1,4 @@
-<svg width="844px" height="182px" xmlns="http://www.w3.org/2000/svg">
+<svg width="844px" height="164px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -30,13 +30,11 @@
 </tspan>
     <tspan x="10px" y="100px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>                      </tspan><tspan class="fg-bright-red bold">^^^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected struct `annotate_snippets::snippet::Slice`, found reference</tspan>
 </tspan>
-    <tspan x="10px" y="118px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan>
+    <tspan x="10px" y="118px"><tspan>   </tspan><tspan class="fg-bright-blue bold">= </tspan><tspan class="fg-bright-green bold">note</tspan><tspan>: expected type: `snippet::Annotation`</tspan>
 </tspan>
-    <tspan x="10px" y="136px"><tspan>   </tspan><tspan class="fg-bright-blue bold">= </tspan><tspan class="fg-bright-green bold">note</tspan><tspan>: expected type: `snippet::Annotation`</tspan>
+    <tspan x="10px" y="136px"><tspan>              found type: `__&amp;__snippet::Annotation`</tspan>
 </tspan>
-    <tspan x="10px" y="154px"><tspan>              found type: `__&amp;__snippet::Annotation`</tspan>
-</tspan>
-    <tspan x="10px" y="172px">
+    <tspan x="10px" y="154px">
 </tspan>
   </text>
 
diff --git a/examples/format.svg b/examples/format.svg
index ac196c0..0e05457 100644
--- a/examples/format.svg
+++ b/examples/format.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="542px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="524px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -74,9 +74,7 @@
 </tspan>
     <tspan x="10px" y="496px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-red bold">|____^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected enum `std::option::Option`</tspan>
 </tspan>
-    <tspan x="10px" y="514px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan>
-</tspan>
-    <tspan x="10px" y="532px">
+    <tspan x="10px" y="514px">
 </tspan>
   </text>
 
diff --git a/examples/multislice.svg b/examples/multislice.svg
index 216a359..92ff9df 100644
--- a/examples/multislice.svg
+++ b/examples/multislice.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="200px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="164px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -27,17 +27,13 @@
 </tspan>
     <tspan x="10px" y="82px"><tspan class="fg-bright-blue bold"> 51 |</tspan><tspan> Foo</tspan>
 </tspan>
-    <tspan x="10px" y="100px"><tspan>    </tspan><tspan class="fg-bright-blue bold">|</tspan>
+    <tspan x="10px" y="100px"><tspan>   </tspan><tspan class="fg-bright-blue bold">:::</tspan><tspan> src/display.rs</tspan>
 </tspan>
-    <tspan x="10px" y="118px"><tspan>   </tspan><tspan class="fg-bright-blue bold">:::</tspan><tspan> src/display.rs</tspan>
+    <tspan x="10px" y="118px"><tspan>    </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
-    <tspan x="10px" y="136px"><tspan>    </tspan><tspan class="fg-bright-blue bold">|</tspan>
+    <tspan x="10px" y="136px"><tspan class="fg-bright-blue bold">129 |</tspan><tspan> Faa</tspan>
 </tspan>
-    <tspan x="10px" y="154px"><tspan class="fg-bright-blue bold">129 |</tspan><tspan> Faa</tspan>
-</tspan>
-    <tspan x="10px" y="172px"><tspan>    </tspan><tspan class="fg-bright-blue bold">|</tspan>
-</tspan>
-    <tspan x="10px" y="190px">
+    <tspan x="10px" y="154px">
 </tspan>
   </text>
 
diff --git a/src/renderer/display_list.rs b/src/renderer/display_list.rs
index c2cb82b..48fbdd0 100644
--- a/src/renderer/display_list.rs
+++ b/src/renderer/display_list.rs
@@ -20,7 +20,6 @@
 //! 152 | |       return "test";
 //! 153 | |   }
 //!     | |___^ error: expected `String`, for `&str`.
-//!     |
 //! ```
 //!
 //! The first two lines of the example above are `Raw` lines, while the rest
@@ -325,7 +324,7 @@ impl DisplaySet<'_> {
                     }
 
                     let text = normalize_whitespace(text);
-                    let line_len = text.as_bytes().len();
+                    let line_len = text.len();
                     let left = self.margin.left(line_len);
                     let right = self.margin.right(line_len);
 
@@ -1013,7 +1012,6 @@ fn format_message(
         sets.push(format_snippet(
             snippet,
             idx == 0,
-            !footer.is_empty(),
             term_width,
             anonymized_line_numbers,
         ));
@@ -1092,7 +1090,6 @@ fn format_label(
 fn format_snippet(
     snippet: snippet::Snippet<'_>,
     is_first: bool,
-    has_footer: bool,
     term_width: usize,
     anonymized_line_numbers: bool,
 ) -> DisplaySet<'_> {
@@ -1102,7 +1099,6 @@ fn format_snippet(
     let mut body = format_body(
         snippet,
         need_empty_header,
-        has_footer,
         term_width,
         anonymized_line_numbers,
     );
@@ -1290,7 +1286,6 @@ fn fold_body(body: Vec<DisplayLine<'_>>) -> Vec<DisplayLine<'_>> {
 fn format_body(
     snippet: snippet::Snippet<'_>,
     need_empty_header: bool,
-    has_footer: bool,
     term_width: usize,
     anonymized_line_numbers: bool,
 ) -> DisplaySet<'_> {
@@ -1605,21 +1600,6 @@ fn format_body(
         );
     }
 
-    if has_footer {
-        body.push(DisplayLine::Source {
-            lineno: None,
-            inline_marks: vec![],
-            line: DisplaySourceLine::Empty,
-            annotations: vec![],
-        });
-    } else if let Some(DisplayLine::Source { .. }) = body.last() {
-        body.push(DisplayLine::Source {
-            lineno: None,
-            inline_marks: vec![],
-            line: DisplaySourceLine::Empty,
-            annotations: vec![],
-        });
-    }
     let max_line_num_len = if anonymized_line_numbers {
         ANONYMIZED_LINE_NUM.len()
     } else {


Test patch:
diff --git a/tests/fixtures/color/ann_eof.svg b/tests/fixtures/color/ann_eof.svg
index bb12aec..b0fb8b6 100644
--- a/tests/fixtures/color/ann_eof.svg
+++ b/tests/fixtures/color/ann_eof.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -28,8 +28,6 @@
     <tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">1 |</tspan><tspan> asdf</tspan>
 </tspan>
     <tspan x="10px" y="100px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>     </tspan><tspan class="fg-bright-red bold">^</tspan>
-</tspan>
-    <tspan x="10px" y="118px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/ann_insertion.svg b/tests/fixtures/color/ann_insertion.svg
index 1f4b6a2..35d65a0 100644
--- a/tests/fixtures/color/ann_insertion.svg
+++ b/tests/fixtures/color/ann_insertion.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -28,8 +28,6 @@
     <tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">1 |</tspan><tspan> asf</tspan>
 </tspan>
     <tspan x="10px" y="100px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>   </tspan><tspan class="fg-bright-red bold">^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">'d' belongs here</tspan>
-</tspan>
-    <tspan x="10px" y="118px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/ann_multiline.svg b/tests/fixtures/color/ann_multiline.svg
index 9130691..949eddc 100644
--- a/tests/fixtures/color/ann_multiline.svg
+++ b/tests/fixtures/color/ann_multiline.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="182px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="164px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -34,8 +34,6 @@
     <tspan x="10px" y="136px"><tspan class="fg-bright-blue bold">141 |</tspan><tspan> </tspan><tspan class="fg-bright-red bold">|</tspan><tspan>                         } = body[body_idx]</tspan>
 </tspan>
     <tspan x="10px" y="154px"><tspan>    </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-red bold">|_________________________^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">missing fields `lineno`, `content`</tspan>
-</tspan>
-    <tspan x="10px" y="172px"><tspan>    </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/ann_multiline2.svg b/tests/fixtures/color/ann_multiline2.svg
index 97948a4..064826a 100644
--- a/tests/fixtures/color/ann_multiline2.svg
+++ b/tests/fixtures/color/ann_multiline2.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="164px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="146px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -32,8 +32,6 @@
     <tspan x="10px" y="118px"><tspan class="fg-bright-blue bold">27 |</tspan><tspan> of an edge case of an annotation overflowing</tspan>
 </tspan>
     <tspan x="10px" y="136px"><tspan class="fg-bright-blue bold">28 |</tspan><tspan> to exactly one character on next line.</tspan>
-</tspan>
-    <tspan x="10px" y="154px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/ann_removed_nl.svg b/tests/fixtures/color/ann_removed_nl.svg
index bb12aec..b0fb8b6 100644
--- a/tests/fixtures/color/ann_removed_nl.svg
+++ b/tests/fixtures/color/ann_removed_nl.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -28,8 +28,6 @@
     <tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">1 |</tspan><tspan> asdf</tspan>
 </tspan>
     <tspan x="10px" y="100px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>     </tspan><tspan class="fg-bright-red bold">^</tspan>
-</tspan>
-    <tspan x="10px" y="118px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/ensure-emoji-highlight-width.svg b/tests/fixtures/color/ensure-emoji-highlight-width.svg
index e5646e6..077bca2 100644
--- a/tests/fixtures/color/ensure-emoji-highlight-width.svg
+++ b/tests/fixtures/color/ensure-emoji-highlight-width.svg
@@ -1,4 +1,4 @@
-<svg width="1356px" height="128px" xmlns="http://www.w3.org/2000/svg">
+<svg width="1356px" height="110px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -28,8 +28,6 @@
     <tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">7 |</tspan><tspan> "haha this isn't a valid name 🐛" = { package = "libc", version = "0.1" }</tspan>
 </tspan>
     <tspan x="10px" y="100px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-red bold">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</tspan>
-</tspan>
-    <tspan x="10px" y="118px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/fold_ann_multiline.svg b/tests/fixtures/color/fold_ann_multiline.svg
index 6a89c4f..39323c5 100644
--- a/tests/fixtures/color/fold_ann_multiline.svg
+++ b/tests/fixtures/color/fold_ann_multiline.svg
@@ -1,4 +1,4 @@
-<svg width="869px" height="236px" xmlns="http://www.w3.org/2000/svg">
+<svg width="869px" height="218px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -41,8 +41,6 @@
     <tspan x="10px" y="190px"><tspan class="fg-bright-blue bold">72 |</tspan><tspan> </tspan><tspan class="fg-bright-red bold">|</tspan><tspan>     }</tspan>
 </tspan>
     <tspan x="10px" y="208px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-red bold">|_____^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected enum `std::option::Option`, found ()</tspan>
-</tspan>
-    <tspan x="10px" y="226px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/fold_bad_origin_line.svg b/tests/fixtures/color/fold_bad_origin_line.svg
index 23f1b64..c7fb916 100644
--- a/tests/fixtures/color/fold_bad_origin_line.svg
+++ b/tests/fixtures/color/fold_bad_origin_line.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -29,8 +29,6 @@
     <tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">3 |</tspan><tspan> invalid syntax</tspan>
 </tspan>
     <tspan x="10px" y="100px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-yellow bold">--------------</tspan><tspan> </tspan><tspan class="fg-yellow bold">error here</tspan>
-</tspan>
-    <tspan x="10px" y="118px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/fold_leading.svg b/tests/fixtures/color/fold_leading.svg
index e69965e..0ff7d15 100644
--- a/tests/fixtures/color/fold_leading.svg
+++ b/tests/fixtures/color/fold_leading.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -28,8 +28,6 @@
     <tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">11 |</tspan><tspan> workspace = 20</tspan>
 </tspan>
     <tspan x="10px" y="100px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>             </tspan><tspan class="fg-bright-red bold">^^</tspan>
-</tspan>
-    <tspan x="10px" y="118px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/fold_trailing.svg b/tests/fixtures/color/fold_trailing.svg
index 41bf7c7..ca9de40 100644
--- a/tests/fixtures/color/fold_trailing.svg
+++ b/tests/fixtures/color/fold_trailing.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -28,8 +28,6 @@
     <tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">1 |</tspan><tspan> lints = 20</tspan>
 </tspan>
     <tspan x="10px" y="100px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>         </tspan><tspan class="fg-bright-red bold">^^</tspan>
-</tspan>
-    <tspan x="10px" y="118px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/issue_9.svg b/tests/fixtures/color/issue_9.svg
index 80b891e..05e421e 100644
--- a/tests/fixtures/color/issue_9.svg
+++ b/tests/fixtures/color/issue_9.svg
@@ -1,4 +1,4 @@
-<svg width="911px" height="236px" xmlns="http://www.w3.org/2000/svg">
+<svg width="911px" height="182px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -30,19 +30,13 @@
 </tspan>
     <tspan x="10px" y="100px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>     </tspan><tspan class="fg-yellow bold">-</tspan><tspan> </tspan><tspan class="fg-yellow bold">move occurs because `x` has type `std::vec::Vec&lt;i32&gt;`, which does not implement the `Copy` trait</tspan>
 </tspan>
-    <tspan x="10px" y="118px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan>
+    <tspan x="10px" y="118px"><tspan class="fg-bright-blue bold">7 |</tspan><tspan> let y = x;</tspan>
 </tspan>
-    <tspan x="10px" y="136px"><tspan class="fg-bright-blue bold">7 |</tspan><tspan> let y = x;</tspan>
+    <tspan x="10px" y="136px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>         </tspan><tspan class="fg-yellow bold">-</tspan><tspan> </tspan><tspan class="fg-yellow bold">value moved here</tspan>
 </tspan>
-    <tspan x="10px" y="154px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>         </tspan><tspan class="fg-yellow bold">-</tspan><tspan> </tspan><tspan class="fg-yellow bold">value moved here</tspan>
+    <tspan x="10px" y="154px"><tspan class="fg-bright-blue bold">9 |</tspan><tspan> x;</tspan>
 </tspan>
-    <tspan x="10px" y="172px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan>
-</tspan>
-    <tspan x="10px" y="190px"><tspan class="fg-bright-blue bold">9 |</tspan><tspan> x;</tspan>
-</tspan>
-    <tspan x="10px" y="208px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-red bold">^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">value used here after move</tspan>
-</tspan>
-    <tspan x="10px" y="226px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan>
+    <tspan x="10px" y="172px"><tspan>  </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-red bold">^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">value used here after move</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/multiple_annotations.svg b/tests/fixtures/color/multiple_annotations.svg
index 84f4749..fc6fe68 100644
--- a/tests/fixtures/color/multiple_annotations.svg
+++ b/tests/fixtures/color/multiple_annotations.svg
@@ -1,4 +1,4 @@
-<svg width="768px" height="290px" xmlns="http://www.w3.org/2000/svg">
+<svg width="768px" height="272px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -46,8 +46,6 @@
     <tspan x="10px" y="244px"><tspan class="fg-bright-blue bold">103 |</tspan><tspan>     }</tspan>
 </tspan>
     <tspan x="10px" y="262px"><tspan class="fg-bright-blue bold">104 |</tspan><tspan> }</tspan>
-</tspan>
-    <tspan x="10px" y="280px"><tspan>    </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/simple.svg b/tests/fixtures/color/simple.svg
index 7b92d23..210cf34 100644
--- a/tests/fixtures/color/simple.svg
+++ b/tests/fixtures/color/simple.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="182px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="164px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -35,8 +35,6 @@
     <tspan x="10px" y="136px"><tspan class="fg-bright-blue bold">171 |</tspan><tspan>         for line in &amp;self.body {</tspan>
 </tspan>
     <tspan x="10px" y="154px"><tspan>    </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>         </tspan><tspan class="fg-bright-red bold">^^^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">unexpected token</tspan>
-</tspan>
-    <tspan x="10px" y="172px"><tspan>    </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/strip_line.svg b/tests/fixtures/color/strip_line.svg
index 9da24fe..f86250a 100644
--- a/tests/fixtures/color/strip_line.svg
+++ b/tests/fixtures/color/strip_line.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -28,8 +28,6 @@
     <tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">LL |</tspan><tspan> </tspan><tspan class="fg-bright-blue bold">...</tspan><tspan>                   let _: () = 42;</tspan>
 </tspan>
     <tspan x="10px" y="100px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>                                   </tspan><tspan class="fg-bright-red bold">^^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected (), found integer</tspan>
-</tspan>
-    <tspan x="10px" y="118px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/strip_line_char.svg b/tests/fixtures/color/strip_line_char.svg
index cbafc78..ed9ba73 100644
--- a/tests/fixtures/color/strip_line_char.svg
+++ b/tests/fixtures/color/strip_line_char.svg
@@ -1,4 +1,4 @@
-<svg width="740px" height="128px" xmlns="http://www.w3.org/2000/svg">
+<svg width="740px" height="110px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -28,8 +28,6 @@
     <tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">LL |</tspan><tspan> </tspan><tspan class="fg-bright-blue bold">...</tspan><tspan>                   let _: () = 42ñ</tspan>
 </tspan>
     <tspan x="10px" y="100px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>                                   </tspan><tspan class="fg-bright-red bold">^^</tspan><tspan> </tspan><tspan class="fg-bright-red bold">expected (), found integer</tspan>
-</tspan>
-    <tspan x="10px" y="118px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/fixtures/color/strip_line_non_ws.svg b/tests/fixtures/color/strip_line_non_ws.svg
index e4f8a85..251dfca 100644
--- a/tests/fixtures/color/strip_line_non_ws.svg
+++ b/tests/fixtures/color/strip_line_non_ws.svg
@@ -1,4 +1,4 @@
-<svg width="1196px" height="164px" xmlns="http://www.w3.org/2000/svg">
+<svg width="1196px" height="146px" xmlns="http://www.w3.org/2000/svg">
   <style>
     .fg { fill: #AAAAAA }
     .bg { background: #000000 }
@@ -32,8 +32,6 @@
     <tspan x="10px" y="118px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>                                                  </tspan><tspan class="fg-bright-red bold">|</tspan>
 </tspan>
     <tspan x="10px" y="136px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan>                                                  </tspan><tspan class="fg-bright-red bold">expected due to this</tspan>
-</tspan>
-    <tspan x="10px" y="154px"><tspan>   </tspan><tspan class="fg-bright-blue bold">|</tspan>
 </tspan>
   </text>
 
diff --git a/tests/formatter.rs b/tests/formatter.rs
index 6faab76..7aa37d2 100644
--- a/tests/formatter.rs
+++ b/tests/formatter.rs
@@ -16,7 +16,6 @@ error: oops
   |
 2 | Second oops line
   |        ^^^^ oops
-  |
 "#]];
 
     let renderer = Renderer::plain();
@@ -37,7 +36,6 @@ error
   |
 1 | こんにちは、世界
   |             ^^^^ world
-  |
 "#]];
 
     let renderer = Renderer::plain();
@@ -60,7 +58,6 @@ error
   |  _____^
 2 | | ございます
   | |______^ Good morning
-  |
 "#]];
 
     let renderer = Renderer::plain();
@@ -84,7 +81,6 @@ error
   | ^^^^^^ Sushi1
 2 | 食べたい🍣
   |     ---- note: Sushi2
-  |
 "#]];
 
     let renderer = Renderer::plain();
@@ -105,7 +101,6 @@ error
   |
 1 | こんにちは、新しいWorld！
   |             ^^^^^^^^^^^ New world
-  |
 "#]];
 
     let renderer = Renderer::plain();
@@ -133,7 +128,6 @@ error
      |
 5402 | This is line 1
 5403 | This is line 2
-     |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -152,11 +146,9 @@ error
     --> file1.rs
      |
 5402 | This is slice 1
-     |
     ::: file2.rs
      |
    2 | This is slice 2
-     |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -180,7 +172,6 @@ error
 5402 | This is line 1
 5403 | This is line 2
      |        -- info: Test annotation
-     |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -224,7 +215,6 @@ error
    |
 56 | This is an example
 57 | of content lines
-   |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -243,7 +233,6 @@ error
   |
 1 | tests
   | ----- help: Example string
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -266,7 +255,6 @@ error
   | |
   | help: Example string
   | help: Second line
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -281,7 +269,6 @@ fn test_only_source() {
 error
 --> file.rs
  |
- |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -300,7 +287,6 @@ LL | This is an example
 LL | of content lines
 LL |
 LL | abc
-   |
 "#]];
     let renderer = Renderer::plain().anonymized_line_numbers(true);
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -323,7 +309,6 @@ error: dummy
 4 | / bar
 5 | | baz
   | |___^
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -349,7 +334,6 @@ error
 3 | / a"
 4 | | // ...
   | |_______^
-  |
 "#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -371,7 +355,7 @@ error
 3 | a
   | ^
 4 | b
-  |"#]];
+"#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
 }
@@ -392,7 +376,7 @@ error
 3 | a
   | ^
 4 | b
-  |"#]];
+"#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
 }
@@ -413,7 +397,6 @@ error
   |   ^^
 2 | にちは
 3 | 世界
-  |
 "#]];
 
     let renderer = Renderer::plain();
@@ -436,7 +419,7 @@ error
 3 | a
   |  ^
 4 | b
-  |"#]];
+"#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
 }
@@ -457,7 +440,7 @@ error
 3 | a
   |  ^
 4 | b
-  |"#]];
+"#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
 }
@@ -478,7 +461,7 @@ error
 3 | a
   |  ^
 4 | b
-  |"#]];
+"#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
 }
@@ -499,7 +482,7 @@ error
 3 | a
   |  ^
 4 | b
-  |"#]];
+"#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
 }
@@ -520,7 +503,6 @@ error
   |     ^
 2 | にちは
 3 | 世界
-  |
 "#]];
 
     let renderer = Renderer::plain();
@@ -544,7 +526,7 @@ error
   |  __^
 4 | | b
   | |_^
-  |"#]];
+"#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
 }
@@ -566,7 +548,7 @@ error
   |  __^
 4 | | b
   | |_^
-  |"#]];
+"#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
 }
@@ -588,7 +570,7 @@ error
   |  __^
 4 | | b
   | |_^
-  |"#]];
+"#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
 }
@@ -610,7 +592,6 @@ error
 2 | | にちは
   | |__^
 3 |   世界
-  |
 "#]];
 
     let renderer = Renderer::plain();
@@ -635,7 +616,6 @@ error
 4 | | b
   | |__^
 5 |   c
-  |
 "#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -659,7 +639,6 @@ error
 4 | | b
   | |__^
 5 |   c
-  |
 "#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -683,7 +662,6 @@ error
 4 | | b
   | |__^
 5 |   c
-  |
 "#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -706,7 +684,6 @@ error
   |  __^
 4 | | b
   | |__^
-  |
 "#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -729,7 +706,6 @@ error
   |  ___^
 4 | | に
   | |___^
-  |
 "#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -761,7 +737,6 @@ error: unused optional dependency
   | ^^^                        --------------- info: This should also be long but not too long
   | |
   | I need this to be really long so I can test overlaps
-  |
 "#]];
     let renderer = Renderer::plain().anonymized_line_numbers(false);
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -799,7 +774,6 @@ error: unused optional dependency
 6 | | so is this
 7 | | bar = { version = "0.1.0", optional = true }
   | |__________________________________________^ I need this to be really long so I can test overlaps
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -845,7 +819,6 @@ error: unused optional dependency
   | ||_________________________^________________^ I need this to be really long so I can test overlaps
   | |__________________________|
   |                            I need this to be really long so I can test overlaps
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -900,7 +873,6 @@ error: unused optional dependency
   |   |                         I need this to be really long so I can test overlaps
 8 |   | this is another line
   |   |____^ I need this to be really long so I can test overlaps
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -925,7 +897,6 @@ error: title
 3 | ccc
   | ^^^ annotation
 4 | ddd
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -950,7 +921,6 @@ error: title
 3 | ccc
   |  ^^ annotation
 4 | ddd
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
diff --git a/tests/rustc_tests.rs b/tests/rustc_tests.rs
index 54b7321..db17bf4 100644
--- a/tests/rustc_tests.rs
+++ b/tests/rustc_tests.rs
@@ -28,7 +28,6 @@ error: foo
   |  __________^
 3 | | }
   | |_^ test
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -59,7 +58,6 @@ error: foo
 4 | |
 5 | |   }
   | |___^ test
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -98,7 +96,6 @@ error: foo
   | ||____^__- `Y` is a good letter too
   | |_____|
   |       `X` is a good letter
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -135,7 +132,6 @@ error: foo
   | ||____-__^ `X` is a good letter
   |  |____|
   |       `Y` is a good letter too
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -175,7 +171,6 @@ error: foo
   | ||____^ `X` is a good letter
 6 |  |   X3 Y3 Z3
   |  |____- `Y` is a good letter too
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -217,7 +212,6 @@ error: foo
   | ||_____|__|
   | |______|  `Y` is a good letter too
   |        `X` is a good letter
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -259,7 +253,6 @@ error: foo
   |      `X` is a good letter
   |      `Y` is a good letter too
   |      `Z` label
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -304,7 +297,6 @@ error: foo
   |  |
 6 |  |   X3 Y3 Z3
   |  |_______- `Z`
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -343,7 +335,6 @@ error: foo
   |  ______-
 6 | |   X3 Y3 Z3
   | |__________- `Y` is a good letter too
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -384,7 +375,6 @@ error: foo
 5 |  |   X2 Y2 Z2
 6 |  |   X3 Y3 Z3
   |  |__________- `Y` is a good letter too
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -412,7 +402,6 @@ error: foo
   |
 3 |   a { b { c } d }
   |   ----^^^^-^^-- `a` is a good letter
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -439,7 +428,6 @@ error: foo
   |
 3 |   a { b { c } d }
   |   ^^^^-------^^ `a` is a good letter
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -469,7 +457,6 @@ error: foo
   |   ----^^^^-^^--
   |       |
   |       `b` is a good letter
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -498,7 +485,6 @@ error: foo
   |   ^^^^-------^^
   |       |
   |       `b` is a good letter
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -527,7 +513,6 @@ error: foo
   |   ^^^^----
   |   |
   |   `a` is a good letter
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -554,7 +539,6 @@ error: foo
   |
 3 |   a { b { c } d }
   |   ^^^^-------^^
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -582,7 +566,6 @@ error: foo
   |
 3 |   a { b { c } d }
   |   ----^^^^-^^--
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -612,7 +595,6 @@ error: foo
   |   |   |
   |   |   `b` is a good letter
   |   `a` is a good letter
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -638,7 +620,6 @@ error: foo
   |
 3 |   a { b { c } d }
   |   ^^^^^^^^^^^^^ `a` is a good letter
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -664,7 +645,6 @@ error: foo
   |
 3 |   a { b { c } d }
   |   ^^^^^^^^^^^^^
-  |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -717,7 +697,6 @@ error: foo
 15 |  |   X2 Y2 Z2
 16 |  |   X3 Y3 Z3
    |  |__________- `Y` is a good letter too
-   |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);
@@ -776,7 +755,6 @@ error: foo
 15 | |  10
 16 | |    X3 Y3 Z3
    | |________^ `Y` is a good letter
-   |
 "#]];
     let renderer = Renderer::plain();
     assert_data_eq!(renderer.render(input).to_string(), expected);