Skip to content

Commit c1a446e

Browse files
committed
Unindent rustc suggestion lines starting with '~' or '+'
1 parent c610b40 commit c1a446e

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

src/normalize.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ normalizations! {
6363
UnindentMultilineNote,
6464
DependencyVersion,
6565
HeadingNote,
66+
UnindentSuggestion,
6667
// New normalization steps are to be inserted here at the end so that any
6768
// snapshots saved before your normalization change remain passing.
6869
}
@@ -669,6 +670,14 @@ fn indented_line_kind(
669670
if spaces > 0
670671
&& (rest == "|"
671672
|| rest.starts_with("| ")
673+
|| normalization >= UnindentSuggestion
674+
&& digits > 0
675+
&& (rest == "~"
676+
|| rest.starts_with("~ ")
677+
|| rest == "+"
678+
|| rest.starts_with("+ ")
679+
|| rest == "-"
680+
|| rest.starts_with("- "))
672681
|| digits == 0
673682
&& (rest.starts_with("--> ") || rest.starts_with("::: ") || rest.starts_with("= ")))
674683
{

src/tests/ghost-note-help.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ help: ensure that all possible cases are being handled by adding a match arm wit
2020
|
2121
" "
2222
error[E0004]: non-exhaustive patterns: `MyPhantom::__Phantom(_)` not covered
23-
--> src/main.rs:9:11
24-
|
25-
9 | match phantom {
26-
| ^^^^^^^ pattern `MyPhantom::__Phantom(_)` not covered
27-
|
23+
--> src/main.rs:9:11
24+
|
25+
9 | match phantom {
26+
| ^^^^^^^ pattern `MyPhantom::__Phantom(_)` not covered
27+
|
2828
note: `MyPhantom<u8>` defined here
29-
--> src/main.rs:4:8
30-
|
31-
3 | #[phantom]
32-
| ---------- not covered
33-
4 | struct MyPhantom<T: ?Sized>;
34-
| ^^^^^^^^^
35-
= note: the matched value is of type `MyPhantom<u8>`
29+
--> src/main.rs:4:8
30+
|
31+
3 | #[phantom]
32+
| ---------- not covered
33+
4 | struct MyPhantom<T: ?Sized>;
34+
| ^^^^^^^^^
35+
= note: the matched value is of type `MyPhantom<u8>`
3636
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
37-
|
37+
|
3838
10 ~ MyPhantom => {},
3939
11 + MyPhantom::__Phantom(_) => todo!()
4040
|

0 commit comments

Comments
 (0)