Skip to content

Commit b723c24

Browse files
committed
ruff_annotate_snippets: update snapshot for single ASCII whitespace source
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.
1 parent ecf1565 commit b723c24

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Diff for: crates/ruff_annotate_snippets/src/renderer/display_list.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1394,9 +1394,7 @@ fn format_body(
13941394
}
13951395
})
13961396
.sum();
1397-
if line.chars().any(|c| !c.is_whitespace()) {
1398-
whitespace_margin = min(whitespace_margin, leading_whitespace);
1399-
}
1397+
whitespace_margin = min(whitespace_margin, leading_whitespace);
14001398
max_line_len = max(max_line_len, line_length);
14011399

14021400
let line_start_index = line_range.0;

Diff for: crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__w292_4.snap

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
---
22
source: crates/ruff_linter/src/rules/pycodestyle/mod.rs
3-
snapshot_kind: text
43
---
54
W292_4.py:1:2: W292 [*] No newline at end of file
65
|
76
1 |
8-
| W292
7+
| ^ W292
98
|
109
= help: Add trailing newline
1110

0 commit comments

Comments
 (0)