fix: Only add extra padding to the first group's last file

This commit is contained in:
Scott Schafer 2025-11-13 03:50:17 -07:00
parent 7c2c3c0ded
commit 1befb0bac0
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -213,6 +213,7 @@ impl AnnotateSnippetEmitter {
file_ann.swap(0, pos);
}
let file_ann_len = file_ann.len();
for (file_idx, (file, annotations)) in file_ann.into_iter().enumerate() {
if should_show_source_code(&self.ignored_directories_in_source_blocks, sm, &file) {
if let Some(snippet) = self.annotated_snippet(annotations, &file.name, sm) {
@ -240,6 +241,7 @@ impl AnnotateSnippetEmitter {
// ╰ warning: this was previously accepted
if let Some(c) = children.first()
&& (!c.span.has_primary_spans() && !c.span.has_span_labels())
&& file_idx == file_ann_len - 1
{
group = group.element(Padding);
}

View file

@ -19,7 +19,6 @@ LL | println!();
error: macro expansion ignores `{` and any tokens following
--> $SRC_DIR/std/src/macros.rs:LL:COL
|
|
::: $DIR/main-alongside-macro-calls.rs:30:1
|
LL | println!();
@ -42,7 +41,6 @@ LL | println!();
error: macro expansion ignores `{` and any tokens following
--> $SRC_DIR/std/src/macros.rs:LL:COL
|
|
::: $DIR/main-alongside-macro-calls.rs:34:1
|
LL | println!();