Commit Graph

19 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez 66c15e46ba lists: Detect block comment by starting from the end.
The issue with the current code is that comments are collapsed, so comments like
the one from the test end up in a string like:

```
"// this is a single line comment\n/* block = */"
```

I chose to fix it by detecting whether we're in a block comment starting from
the end instead, and tested a single-line comment ended in `*/` just for sanity,
ensuring line breaks are not removed in that case, which would break the
formatting.

The right fix eventually is probably to lex the comments properly, but this does
the work for now, I guess :)

Fixes #3025
2018-09-22 12:16:38 +02:00
cad97 04d804c365 Rename CodeMap/FileMap to SourceMap/SourceFile
#2946
2018-08-23 17:10:46 -04:00
Stéphane Campinas a4d1469baf removed comment with default: rustfmt-indent_style 2018-06-27 01:35:53 +02:00
Nick Cameron 4f522794ae Tidy up and pass tests 2018-03-02 15:07:13 +13:00
topecongiro 4af2aa3a9e Create rustfmt_core crate 2018-02-07 22:48:05 +09:00
topecongiro 96f3c36c04 Replace '_indent' with 'indent_style' 2017-11-13 17:33:32 +09:00
topecongiro d5d8740993 Rename 'fn_call_style' to 'fn_call_indent' 2017-11-04 22:46:40 +09:00
topecongiro 5096cdff56 Rename 'array_layout' to 'array_indent' 2017-11-04 22:45:09 +09:00
Vadim Petrochenkov 6e5c6f5ba3 Use getters to access Span fields 2017-08-31 14:14:13 +12:00
topecongiro 10f1257eb3 Use correct width for subexpr_list 2017-08-13 10:17:52 +09:00
topecongiro 021f922b9c Keep the pre-comment on the same line with item if it fits max width 2017-08-08 18:24:06 +09:00
topecongiro f83c22f24f Add trailing comma to a single arg in multiline 2017-05-23 13:26:59 +09:00
topecongiro b4cd9584b3 Implement combining for tuple and block 2017-05-23 12:51:32 +09:00
topecongiro 2c15204f0c Update tests 2017-05-23 12:51:13 +09:00
Nick Cameron 75a13868da Block format control flow discriminant expressions and binops
Fixes #1450

Adds control_style option
2017-05-05 14:37:13 +12:00
Nick Cameron a7183766b9 Test fallout 2017-04-06 13:06:11 +12:00
Ryan1729 822b266a3d add tests that fail because of comma insertion
Signed-off-by: Ryan1729 <Ryan1729@gmail.com>
2017-04-03 16:15:11 -06:00
Nick Cameron 8bca85c4b6 Support block indent for function calls
Uses the `fn_call_style` option.

Fixes #1358
2017-03-28 10:43:46 +13:00
Nick Cameron 0cb6f56647 Block formatting for arrays
Fixes #1331
2017-03-20 10:26:19 +13:00