* Add custom comments
This allows users to use custom comments such as
```
//@ this is a custom comment
//@ with multiple lines
```
without having them destroyed by rustfmt.
* Fix issues with empty lines
* Check non-whitespace right after custom comments
Only change multiline comments of the form
```rust
/*
* Text
*/
```
while not affecting comments of the form
```rust
/*
Text
*/
```
when normalize_comments is off. In the first case,
we have a known character we can align against, while
we don't have one in the second case.
Before, we have converted the second form into the first,
but this is against the spirit of normalize_comments being
turned off.
Fixes#956
* Handle attributes (including doc comments) on inline modules
Closes#22Closes#684
* Tweak the rules for changing indentation in comments (to do it less often).
We will no longer break in the middle of words, only at whitespace or punctuation.
This means we sometimes over-run, but that seems better than some of the bad splits we see.
Closes#369
When the reformatted code doesn't contain the same quantity of comments
as the original code, use the original code instead of the reformatted
code.
This is done for all expressions and `let` statements.
This should be used at the finest grained level possible, to avoid that
a small disappearing comment prevents a big chunk of code to be
reformatted.
Kind of fixes (avoid disappearing comments, but prevents a good
formatting is such case) #285#225#563#743
This removes usage of:
* PathExt
* split_last
* split_last_mut
* catch_panic
The catch_panic one was a little tricky as the ident interner needed to be
cloned across threads (a little unsafely), but it should otherwise be good to
go.
Rustfmt would leave the literal unchanged when it did not exceed the column limit in its original position, not considering its position after formatting.
This make a base for all functions searching for comments, or searching
code excluding comments, etc. These functions where too simple and
didn't handle complicated cases like nested comments or comment marks
inside string litterals ("/*").