forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fmt): format comments supertraits (FuelLabs#4129)
## Description Followup to FuelLabs#4005 makes `abi_supertraits` test pass comment formatting without `handle_comments`. In fixing this, this also inadvertently led to me fixing other formatting issues: - There may be comments before the module declaration - the first one was tagged as a `Trailing` comment, even though it should not be. Added a 0 check within lexing for this. - Massively simplified `comments.rs` - before, we used to arbitrarily compare to the previous token, but now that we have the concept of `Trailing` and `Newlined` comments, we do not need to do this. We also used to write an indent after writing a trailing comment, but I think this should be moved up-one-level to whereever the trailing comment was written. There is also an update to a test that retains the trailing nature of a trailing comment in an existing test. For the rest of changes, they seem largely unrelated to what this PR claims to solve, so I'll go change by change: - within `item_fn/mod.rs`: This fixes the supertraits test example (which had a weird spacing for expected comment output) - within `module/mod.rs`: We format comments between items (this fixes the the tests like `abi_comments` and `abi_supertrait` that have comments written between items. ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [x] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
- Loading branch information
1 parent
10545f9
commit 67b29ac
Showing
7 changed files
with
72 additions
and
40 deletions.
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
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
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
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