Skip to content

Commit

Permalink
Merge pull request #179 from epage/trailing
Browse files Browse the repository at this point in the history
fix: Remove trailing pipe
  • Loading branch information
Muscraft authored Feb 12, 2025
2 parents 32dc464 + 41825aa commit bb7d437
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 161 deletions.
6 changes: 2 additions & 4 deletions examples/expected_type.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions examples/footer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions examples/format.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 5 additions & 9 deletions examples/multislice.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 1 addition & 21 deletions src/renderer/display_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -1013,7 +1012,6 @@ fn format_message(
sets.push(format_snippet(
snippet,
idx == 0,
!footer.is_empty(),
term_width,
anonymized_line_numbers,
));
Expand Down Expand Up @@ -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<'_> {
Expand All @@ -1102,7 +1099,6 @@ fn format_snippet(
let mut body = format_body(
snippet,
need_empty_header,
has_footer,
term_width,
anonymized_line_numbers,
);
Expand Down Expand Up @@ -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<'_> {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions tests/fixtures/color/ann_eof.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/ann_insertion.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/ann_multiline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/ann_multiline2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/ann_removed_nl.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/ensure-emoji-highlight-width.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/fold_ann_multiline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/fold_bad_origin_line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/fold_leading.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/fold_trailing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 5 additions & 11 deletions tests/fixtures/color/issue_9.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/multiple_annotations.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/simple.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/strip_line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions tests/fixtures/color/strip_line_char.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bb7d437

Please sign in to comment.