-
Notifications
You must be signed in to change notification settings - Fork 898
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle block comment before Traits in derive attribute (issue 4984)
When a block comment comes before the traits of a derive attribute the string "#[derive(" is included as part of the the pre snippet, and as a result gets duplicated. For example: #[derive(/*Debug, */Clone)] -> #[derive(#[derive(/*Debug, */ Clone)] Now the string "#[derive(" is trimmed from the start of the pre snippet before looking for the pre comment.
- Loading branch information
Showing
5 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#[derive(/*Debug, */Clone)] | ||
struct Foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#[derive( | ||
/* ---------- Some really important comment that just had to go inside the derive --------- */ | ||
Debug, Clone, Eq, PartialEq, | ||
)] | ||
struct Foo { | ||
a: i32, | ||
b: T, | ||
} | ||
|
||
#[derive( | ||
/* | ||
Some really important comment that just had to go inside the derive. | ||
Also had to be put over multiple lines | ||
*/ | ||
Debug, Clone, Eq, PartialEq, | ||
)] | ||
struct Bar { | ||
a: i32, | ||
b: T, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#[derive(/*Debug, */ Clone)] | ||
struct Foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#[derive( | ||
/* ---------- Some really important comment that just had to go inside the derive --------- */ | ||
Debug, | ||
Clone, | ||
Eq, | ||
PartialEq, | ||
)] | ||
struct Foo { | ||
a: i32, | ||
b: T, | ||
} | ||
|
||
#[derive( | ||
/* | ||
Some really important comment that just had to go inside the derive. | ||
Also had to be put over multiple lines | ||
*/ | ||
Debug, | ||
Clone, | ||
Eq, | ||
PartialEq, | ||
)] | ||
struct Bar { | ||
a: i32, | ||
b: T, | ||
} |