Skip to content

Commit 83b7a7d

Browse files
authored
Merge pull request #308 from dtolnay/rightalign
Recognize right aligned line numbers
2 parents 9e3eb03 + 6ff60c4 commit 83b7a7d

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/normalize.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,12 @@ fn indented_line_kind(
634634
return IndentedLineKind::Code(spaces);
635635
}
636636

637-
let digits = line.bytes().take_while(u8::is_ascii_digit).count();
638-
let spaces = line[digits..].bytes().take_while(|b| *b == b' ').count();
637+
let mut spaces = line.bytes().take_while(is_space).count();
638+
let digits = line[spaces..]
639+
.bytes()
640+
.take_while(u8::is_ascii_digit)
641+
.count();
642+
spaces += line[spaces + digits..].bytes().take_while(is_space).count();
639643
let rest = &line[digits + spaces..];
640644
if spaces > 0
641645
&& (rest == "|"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
test_normalize! {
2+
INPUT="tests/ui-testing-optout.rs"
3+
"
4+
error[E0412]: cannot find type `F` in this scope
5+
--> $DIR/ui-testing-optout.rs:92:10
6+
|
7+
4 | type A = B;
8+
| ----------- similarly named type alias `A` defined here
9+
...
10+
92 | type E = F;
11+
| ^ help: a type alias with a similar name exists: `A`
12+
" "
13+
error[E0412]: cannot find type `F` in this scope
14+
--> $DIR/ui-testing-optout.rs:92:10
15+
|
16+
4 | type A = B;
17+
| ----------- similarly named type alias `A` defined here
18+
...
19+
92 | type E = F;
20+
| ^ help: a type alias with a similar name exists: `A`
21+
"}

0 commit comments

Comments
 (0)