Commit Graph

788 Commits

Author SHA1 Message Date
Gaëtan Cassiers
9f98f725cb Detect when comments disappear
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
2016-01-10 15:20:58 +01:00
Marcus Klaas de Vries
66abad9445 Merge pull request #749 from sanxiyn/skip-arm
Add commas after skipped arms when needed
2016-01-08 14:39:04 +01:00
Seo Sanghyeon
16b348dd9c Add commas after skipped arms when needed 2016-01-08 22:15:54 +09:00
Nick Cameron
bd32589ff5 Merge pull request #747 from Manishearth/clippy
Clippy rustfmt
2016-01-07 20:15:49 +13:00
Manish Goregaokar
ffe9c9d834 Clippy rustfmt 2016-01-07 12:17:22 +05:30
Nick Cameron
f5bd7b76e0 Merge pull request #744 from sanxiyn/wildcard-arm
Trailing commas for wildcard arms
2016-01-06 16:48:11 +13:00
Seo Sanghyeon
f9f7235c1b Trailing commas for wildcard arms 2016-01-06 11:02:01 +09:00
Nick Cameron
d290271db4 Merge pull request #739 from svmnotn/case_insensitive_config_options
ignore case for config enums. Fixes #738
2016-01-05 07:40:03 +13:00
Victor M. Suarez
f6497ca3fb ignore case for config enums. Fixes #738 2016-01-02 20:47:58 -05:00
Marcus Klaas de Vries
fe58ff1a15 Merge pull request #736 from sinhpham/vsc_doc
Add doc for Visual Studio Code plugins
2016-01-02 17:46:35 +01:00
Marcus Klaas de Vries
8d5bb2bb17 Merge pull request #734 from sinhpham/issue_700
Fixed #700
2016-01-01 20:21:15 +01:00
Sinh Pham
b5e9088ed3 Add doc for Visual Studio Code plugins 2016-01-01 09:30:36 -08:00
Sinh Pham
122fc4bc65 Fixed #700, use default color for titles and context in write-mode=diff 2016-01-01 09:14:39 -08:00
Marcus Klaas de Vries
0698f0255a Merge pull request #732 from utkarshkukreti/update-diff-to-0.1.8
Update diff to 0.1.8
2015-12-28 17:45:56 +01:00
Utkarsh Kukreti
15e6b7d335 Add tests for #606. 2015-12-28 17:23:34 +05:30
Utkarsh Kukreti
6a12818c23 Bump diff to 0.1.8. Fixes #606. 2015-12-28 17:22:03 +05:30
Marcus Klaas de Vries
e72c245023 Merge pull request #729 from marcusklaas/funky-self
Make fn argument formatting more resilient for complex self types
2015-12-27 15:09:14 +01:00
Marcus Klaas
291aa1b228 Make fn argument formatting more resilient for complex self types 2015-12-27 14:25:37 +01:00
Nick Cameron
71508b310b Merge pull request #728 from marcusklaas/typed-mut-self
format typed mut self
2015-12-27 09:18:20 +13:00
Nick Cameron
856bf043d1 Merge pull request #726 from marcusklaas/string-backslashes
Prevent incorrect backslash removal in strings
2015-12-27 09:15:34 +13:00
Marcus Klaas
2069abcca4 Reduce dependency on pprust 2015-12-25 20:59:46 +01:00
Marcus Klaas
954dd0869e Preserve mutability for typed self arguments 2015-12-25 19:07:51 +01:00
Marcus Klaas
1e80fd2dcd Prevent incorrect backslash removal in strings 2015-12-25 18:50:40 +01:00
Nick Cameron
c0b7de7c52 Merge pull request #722 from matklad/test-ignore-children
test ignored out of line modules
2015-12-24 11:11:56 +13:00
Aleksey Kladov
e3123ce88c test ignored out of line modules
tests #719
2015-12-24 00:15:29 +03:00
Nick Cameron
55506b8da0 Merge pull request #720 from matklad/update-lcok
update Cargo.lock to match Cargo.toml
2015-12-24 09:34:18 +13:00
Nick Cameron
9107fac712 Merge pull request #719 from matklad/ignore-child-mods
add option to ignore out of line modules
2015-12-24 09:32:44 +13:00
Aleksey Kladov
b3f691fa13 update Cargo.lock to match Cargo.toml 2015-12-23 17:31:54 +03:00
Aleksey Kladov
a70b621607 add option to ignore out of line modules 2015-12-23 17:25:49 +03:00
Nick Cameron
47f473dbd9 Merge pull request #713 from JanLikar/master
Add verbose and quiet flags to cargo-fmt
2015-12-21 07:50:02 +13:00
Jan Likar
a5da67f4c4 Add verbose and quiet flags to cargo-fmt
Quiet mode supresses rustfmt's stdout, verbose mode prints targets that
are going to be formatted.
2015-12-20 04:19:08 +01:00
Nick Cameron
0b5e6d57e5 Merge pull request #710 from JanLikar/master
Remove `--write-mode=replace` from cargo-fmt
2015-12-18 08:43:41 +13:00
Jan Likar
c578ad8df5 Remove --write-mode=replace from cargo-fmt
Since replace is the default rustfmt write mode, there's no need to
call rustfmt with `--write-mode=replace`. As a bonus, it is now also
possible to override the write-mode.
2015-12-17 17:17:43 +01:00
Marcus Klaas de Vries
41169dfdf5 Merge pull request #704 from Sean1708/patch-1
Fix spelling mistake in cargo-fmt usage string.
2015-12-16 18:43:19 +01:00
Sean Marshallsay
7f21569351 Fix spelling mistake in cargo-fmt usage string. 2015-12-16 12:18:18 +00:00
Nick Cameron
ecf12778fb Use replace rather than overwrite for cargo fmt 2015-12-16 18:07:59 +13:00
Nick Cameron
33d20479f2 make cargo install easier 2015-12-16 18:00:40 +13:00
Nick Cameron
909b3560ba Add quick start info to README.md, cargo update. 2015-12-16 17:58:20 +13:00
Nick Cameron
b37e78974c Merge pull request #703 from JanLikar/cargo-fmt
Add cargo-fmt binary
2015-12-16 17:51:29 +13:00
Jan Likar
1e5e290e39 Allow to pass arguments to rustfmt 2015-12-16 04:48:49 +01:00
Jan Likar
959c2e7bed Improve README.md 2015-12-16 04:41:58 +01:00
Jan Likar
360f3efce8 Replace locate-project with read-manifest
Use `cargo read-manifest` instead of `cargo locate-project` to get
a list of files to be formatted.
2015-12-16 02:21:43 +01:00
Jan Likar
f5d1c06739 Remove unneeded dependencies
Remove dependency on Walkdir, which is no longer needed, because
cargo-fmt now uses cargo read-manifest to get a list of targets to
format.
2015-12-15 23:57:05 +01:00
Jan Likar
169bff0e52 Edit README.md
- Add instructions for using cargo run with multiple binaries
  - Mention cargo-fmt binary
2015-12-15 01:18:47 +01:00
Jan Likar
623277e7e0 Add cargo-fmt binary
Add a new utility, which formats all readable .rs files in the src
directory of the crate using rustfmt. Both binaries can be installed
using cargo install rustfmt. cargo-fmt can be used as a Cargo
subcommand - cargo fmt.
2015-12-14 15:50:19 +01:00
Jan Likar
681245f3fb Update Cargo.lock 2015-12-14 15:49:46 +01:00
Jan Likar
ec509b0517 Change Cargo.toml
Change Cargo.toml to include cargo-fmt's dependencies and add a
default cargo-fmt feature to enable users to only build rustfmt
if they don't need cargo-fmt.
2015-12-14 15:32:03 +01:00
Marcus Klaas de Vries
d42383e3ed Merge pull request #697 from rust-lang-nursery/crates
Use crates.io for everything
2015-12-13 20:20:29 +01:00
Nick Cameron
beabc60575 Fix the notes on running rustfmt 2015-12-14 08:17:26 +13:00
Nick Cameron
78957d371e Use crates.io for everything 2015-12-14 08:03:58 +13:00