Seiichi Uchida
dec307b2fa
Merge pull request #2584 from sinkuu/cleanup
...
Misc cleanups
2018-04-01 23:14:52 +09:00
Shotaro Yamada
e2d801f11e
Do not turn spaces in the beginning of the file into a newline ( #2583 )
2018-04-01 23:09:53 +09:00
Shotaro Yamada
71448ff3c2
Return String instead of always returing Cow::Owned
2018-04-01 22:29:26 +09:00
Shotaro Yamada
ed46a777c8
Use str::repeat
2018-04-01 22:29:26 +09:00
Nick Cameron
0cf80dcce7
Better handle comments and newlines around erased imports
2018-03-20 09:27:31 +13:00
Nick Cameron
39301ae5f2
Go back to a non-workspace structure
...
Kinda reverts https://github.com/rust-lang-nursery/rustfmt/pull/2419
2018-03-02 14:58:23 +13:00
topecongiro
4af2aa3a9e
Create rustfmt_core crate
2018-02-07 22:48:05 +09:00
topecongiro
984ac100a4
Fix indent width bug when recovering comments
...
Using last_line_width() ignores the width of tab character ('\t').
2017-12-22 12:05:36 +09:00
Oliver Schneider
fad903fd14
Move from String to PathBuf where applicable
2017-12-15 10:26:19 +09:00
Seiichi Uchida
efb68ee21a
Refactor write_snippet_inner()
2017-12-12 13:48:24 +09:00
Seiichi Uchida
db29f9e0f7
Fix indent issue when recovering comments
...
Closes #1989
2017-12-11 09:20:02 +09:00
Seiichi Uchida
414a995926
Replace StringBuffer with String
2017-12-11 09:19:00 +09:00
topecongiro
5e6bb3edb0
Keep track of line number in visitor
2017-12-08 16:59:04 +09:00
Seiichi Uchida
04449c6622
Handle cases when bound changed from the default
2017-12-05 17:38:27 +09:00
Seiichi Uchida
1d1305eef8
Take into account a trailing newline in buffer
2017-12-05 17:15:42 +09:00
Seiichi Uchida
5632a7c075
Process blank lines if only they're within file lines range
2017-12-05 17:14:57 +09:00
Seiichi Uchida
53616f63b1
Keep blank lines around comments with range
2017-12-05 16:39:45 +09:00
Seiichi Uchida
829d94940e
Factor out process_comment()
2017-12-05 16:25:33 +09:00
Seiichi Uchida
d96a48c517
Change the type of argument of push_vertical_spaces()
2017-12-05 15:19:36 +09:00
Seiichi Uchida
228578b9c7
Add count_newlines() utility function
2017-12-05 15:17:40 +09:00
Seiichi Uchida
c4c9bf028a
Keep vertical spaces between items or statements within range
2017-12-02 17:43:50 +09:00
Seiichi Uchida
df7d2be562
Move Indent and Shape to shape.rs from lib.rs
2017-09-19 10:04:35 +09:00
Nick Cameron
cccb7f681e
Merge pull request #1966 from topecongiro/string-to-cow
...
Refactoring: use Cow and etc.
2017-09-18 12:45:25 +12:00
topecongiro
f0580ae91a
Use Cow to avoid unnecessary allocation
2017-09-15 18:21:06 +09:00
topecongiro
f51261e93e
Cargo fmt
2017-09-15 12:10:58 +09:00
Seiichi Uchida
97d9e6b373
Use the last line's width for indent width in rewriting missed span
...
to fix unindented comments
2017-09-05 16:54:02 +09:00
Seiichi Uchida
4b79055a15
Apply refactoring from cargo clippy
2017-08-31 12:49:12 +09:00
Vadim Petrochenkov
6e5c6f5ba3
Use getters to access Span
fields
2017-08-31 14:14:13 +12:00
Seiichi Uchida
f9239dd630
Format source codes and update tests
2017-08-09 16:36:41 +09:00
topecongiro
6fd291981e
Sort imports in alphabetical and consistent order
2017-07-13 18:42:14 +09:00
topecongiro
54233acc8e
Format source codes
2017-06-17 16:56:54 +09:00
topecongiro
208ff15954
Format source codes
2017-06-16 08:49:49 +09:00
Nick Cameron
1f512948a0
Reformat source code using new defaults
2017-06-13 14:41:49 +12:00
est31
727963afe4
Update syntex_syntax
...
Bases on commit to switch to libsyntax by @nrc
2017-06-06 07:31:47 +02:00
topecongiro
a9f529cba4
Format source codes
2017-06-04 19:35:29 +09:00
topecongiro
33a7357543
Fix index bug in write_snippet_inner
2017-05-30 10:53:48 +09:00
topecongiro
77a2e9858b
Format source codes
2017-05-23 11:37:33 +09:00
Michael Killough
c3c2e823cb
Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config
2017-05-18 13:05:19 +07:00
topecongiro
d7b6f1199f
Format source codes
2017-05-16 23:24:38 +09:00
Michael Killough
c0bdbfa531
Switch to accessing config items via method.
...
Preparation for #865 , which proposes adding a flag which outputs which
config options are used during formatting.
This PR should not make any difference to functionality. A lot of this
was search-and-replace.
Some areas worthy of review/discussion:
- The method for each config item returns a clone of the underlying
value. We can't simply return an immutable reference, as lots of
places in the code expect to be able to pass the returned value as
`bool` (not `&bool). It would be nice if the `bool` items could
return a copy, but the more complex types a borrowed reference... but
unfortunately, I couldn't get the macro to do this.
- A few places (mostly tests and `src/bin/rustfmt.rs`) were overriding
config items by modifying the fields of the `Config` struct directly.
They now use the existing `override_value()` method, which has been
modified to return a `Result` for use by `src/bin/rustfmt.rs`. This
benefits of this are that the complex `file_lines` and `write_mode`
strings are now parsed in one place (`Config.override_value`) instead
of multiple. The disadvantages are that it moves the compile-time
checks for config names to become run-time checks.
2017-05-16 15:47:09 +07:00
Seiichi Uchida
762db5138e
Format source codes
2017-05-15 22:55:45 +09:00
Jonathan Behrens
b1c9832c9b
Respect file_lines within write_snippet() function
2017-05-06 17:59:51 -04:00
Nick Cameron
5305bc8436
test fallout
2017-03-28 11:25:59 +13:00
Nick Cameron
5fb1140688
fallout - source reformatting
2017-03-28 11:14:47 +13:00
Nick Cameron
e4efa22983
Source formatting fallout
2017-03-28 10:58:41 +13:00
C4K3
ab832fa4bb
config: Rename ideal_width -> comment_width ( #1370 )
...
Since the config option only affects comment widths, and the previous
name has led to some confusion (see #1321 , #1152 ).
2017-03-13 09:07:33 +13:00
Nick Cameron
33b83ae7df
Formatting fallout
...
Also fixes a minor bug when we break a line after `if` and used to leave a trailing space
2017-03-07 09:50:41 +13:00
Nick Cameron
9eb78a3333
Fallout
2017-02-23 13:15:48 +13:00
Nick Cameron
428339fdc3
Refactor indent and width into Shape struct
2017-01-31 08:35:23 +13:00
Nick Cameron
2261947f6e
Catch attributes before comments
...
Closes #1280
Closes #1284
2017-01-26 15:10:47 +13:00