Skip to content

Commit

Permalink
ruff_annotate_snippets: update snapshot for single ASCII whitespace s…
Browse files Browse the repository at this point in the history
…ource

The change to the rendering code is elaborated on in more detail here,
where I attempted to upstream it:
rust-lang/annotate-snippets-rs#169

Otherwise, the snapshot diff also shows a bug fix: a `^` is now rendered
where as it previously was not.
  • Loading branch information
BurntSushi committed Jan 14, 2025
1 parent 677d3e4 commit 77c1d00
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions crates/ruff_annotate_snippets/src/renderer/display_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1394,9 +1394,7 @@ fn format_body(
}
})
.sum();
if line.chars().any(|c| !c.is_whitespace()) {
whitespace_margin = min(whitespace_margin, leading_whitespace);
}
whitespace_margin = min(whitespace_margin, leading_whitespace);
max_line_len = max(max_line_len, line_length);

let line_start_index = line_range.0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
snapshot_kind: text
---
W292_4.py:1:2: W292 [*] No newline at end of file
|
1 |
| W292
| ^ W292
|
= help: Add trailing newline

Expand Down

0 comments on commit 77c1d00

Please sign in to comment.