Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 533d426

Browse files
committed
fix: Allow merging of multiline duplicate annotations
1 parent 9525c38 commit 533d426

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

‎src/renderer/source_map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,18 @@ impl<'a> SourceMap<'a> {
213213

214214
// Find overlapping multiline annotations, put them at different depths
215215
multiline_annotations.sort_by_key(|ml| (ml.start.line, usize::MAX - ml.end.line));
216-
for ann in multiline_annotations.clone() {
216+
for (outer_i,ann) in multiline_annotations.clone().into_iter().enumerate() {
217217
if ann.kind.is_primary() {
218218
primary_spans.push((ann.start, ann.end));
219219
}
220-
for a in &mut multiline_annotations {
220+
for (inner_i, a) in &mut multiline_annotations.iter_mut().enumerate() {
221221
// Move all other multiline annotations overlapping with this one
222222
// one level to the right.
223223
if !ann.same_span(a)
224224
&& num_overlap(ann.start.line, ann.end.line, a.start.line, a.end.line, true)
225225
{
226226
a.increase_depth();
227-
} else if ann.same_span(a) && &ann != a {
227+
} else if ann.same_span(a) && outer_i != inner_i {
228228
a.overlaps_exactly = true;
229229
} else {
230230
if primary_spans

‎tests/formatter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4259,7 +4259,7 @@ warning: whatever
42594259
2 | |
42604260
3 | | foobar 🚀
42614261
| | ^
4262-
| |______________________|
4262+
| ||
42634263
| |______________________blah
42644264
| blah
42654265
"#]];
@@ -4274,7 +4274,7 @@ warning: whatever
42744274
2 │ ┃
42754275
3 │ ┃ foobar 🚀
42764276
│ ┃ ╿
4277-
│ ┃━━━━━━━━━━━━━━━━━━━━━━
4277+
│ ┃│
42784278
│ ┗━━━━━━━━━━━━━━━━━━━━━━blah
42794279
╰╴ blah
42804280
"#]];

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /