Commit Graph

1188 Commits

Author SHA1 Message Date
Nick Cameron
bce26d51bd Merge pull request #1134 from sinkuu/issue977
Fix #977
2016-08-29 07:07:48 +12:00
sinkuu
130c593544 Fix #977 2016-08-28 16:40:03 +09:00
Nick Cameron
35624c54e5 Merge pull request #1142 from kamalmarhubi/fix-1140
Check term supports colour before printing fancy diffs
2016-08-28 17:48:31 +12:00
Kamal Marhubi
05882314f5 Check term supports colour before printing fancy diffs
For a terminal like DUMB, we were still attempting to print colourful
diffs, which failed with a `NotSupported` error.

Fixes #1140
2016-08-26 17:08:47 -04:00
Nick Cameron
59e199b439 Merge pull request #1138 from johannhof/travis-docs
Add instructions on how to run rustfmt on Travis
2016-08-25 17:30:03 +12:00
Johann Hofmann
c8e871fb4d
Add instructions on how to run rustfmt on Travis
This adds very simplistic instructions on how to run rustfmt on CI.

I also wrote a blog post for more details: http://johannh.me/blog/rustfmt-ci.html
2016-08-24 23:51:36 +02:00
Stuart Dootson
61042e6e4d Fix issue 1124 - detect start of output rather than start of input file when writing output source file (#1133)
* Change required to prevent a trailing space at the end of a separate module being propagated

* Detect the start of the output file rather than the start of the input file when deciding whether to output preceding snippets - this stops unnecessary whitespace and blank lines from being inserted when spans and statements are output in an order other than that from the input file.

* Add code to prevent space from being added with the prefix snippet if a) the snippet is entirely horizontal whitespace, or b) the snippet contains whitespace  followed by a newline. This prevents trailing spaces at the end of a line from being added.

* Tests for this issue

* Tidy up `match` statements

* Add test with blank lines between `use` statements
2016-08-25 08:32:04 +12:00
Nick Cameron
d022f05f34 v0.6.0 2016-08-11 10:08:59 +12:00
Nick Cameron
e1759ae295 Merge pull request #1123 from juicejitsu/807
Don't emit filename in diff mode, add filename to diff metadata
2016-08-10 21:52:46 +12:00
Stuart Dootson
4029b0e704 Fix #1120 - rework how the use list prefix is determined. (#1121)
* Fix #1120 - rework how the use list prefix is determined.

* Added test commentary & another test case
2016-08-10 18:13:27 +12:00
Nick Cameron
9ed9618f1c Merge pull request #1122 from studoot/add-test-for-1111
Add test case for issue #1111
2016-08-10 18:12:16 +12:00
juicejitsu
a0de408198 Don't emit filename in diff mode, add filename to diff metadata 2016-08-09 18:21:04 -07:00
Stuart Dootson
5dda986a2c Add commentary 2016-08-09 22:11:27 +02:00
Stuart Dootson
4055e272da Reformat the source to actually pass the tests! 2016-08-09 22:10:48 +02:00
Stuart Dootson
cb0b7108ca Add test case for issue #1111, by adding another route by which a test file's config can be located 2016-08-08 23:13:45 +02:00
Nick Cameron
69f647b9f1 Merge pull request #1119 from HighCommander4/issue1109b
Apply space_before_type_annotation to struct ctors (#1109)
2016-08-05 18:03:34 +12:00
Nathan Ridge
899169a1d2 Apply space_before_type_annotation to struct ctors (#1109) 2016-08-05 01:30:53 -04:00
Nick Cameron
f21808a65c Merge pull request #1117 from pepyakin/issue-1116
Fix underflow in format_imports
2016-08-05 16:29:41 +12:00
Sergey Pepyakin
f6959a4772 Fix issue-1116 2016-08-04 08:54:40 +03:00
Nick Cameron
fe69e975e3 Merge pull request #1110 from HighCommander4/issue1109a
Add two new whitespace options (#1109)
2016-08-04 10:58:32 +12:00
Nick Cameron
9ea53d617d Merge pull request #1118 from julienXX/change-multirust-to-rustup-in-readme
Update README with Rustup.rs instead of multirust
2016-08-04 10:11:24 +12:00
Julien Blanchard
fb1493055b Update README with Rustup.rs instead of multirust 2016-08-03 11:49:09 +02:00
Nathan Ridge
4b999a99c0 Add two new whitespace options (#1109)
* An option to leave a space before the colon in a type annotation

* An option to leave a space before the colon in a trait or lifetime bound
2016-08-03 01:11:39 -04:00
Nick Cameron
b57ea4e39a Merge pull request #1052 from julienXX/fix-imports-with-absolute-paths
Fix imports with absolute paths
2016-08-02 09:25:25 +12:00
Julien Blanchard
b4e49ddbf5 Fix imports with absolute paths 2016-08-01 10:10:04 +02:00
dawirstejeck
22de7ced28 Fix overlong function signature (#1089)
* Fix issue-1049

* Add testcase suggested by pepyakin

* Fix last commit

* Handle special case

* Remove debugging println

* Fix grammar in comment

* Change word in comment

* Add test for long func without ret type

* Add one more test
2016-08-01 16:25:00 +12:00
Daniel Campoverde
6380937b59 Multiple config file names feature (#1101)
* Add multiple configuration file names feature

* Add '.rustfmt.toml' in README file

* Clean up configuration file code

* Make config file names constant

* Use only one blank line
2016-08-01 09:32:35 +12:00
dawirstejeck
e76cb6a907 Fix overlong impl (#1091)
* Fix issue-1048

* Take possible where-clause into account

* Move test to existing test set

* Fix wrong variable name
2016-07-26 17:34:11 +12:00
Stuart Dootson
78b52ec3e1 Add use declaration re-ordering (#1104)
* Add config options for combinations of lines and items

* Reordering of import lines implemented.

* Changed nested matches to tuple pattern matching

* Added ordering of path list items to the ordering of use declarations

* Move `format_imports` and `format_import` methods to `imports.rs`

* Add comment to explain how `use` declarations are split off while walking through a module

* Change `ImportReordering` config option to separate boolean options
2016-07-26 17:20:01 +12:00
Stuart Dootson
9750fb7fca Canonicalize file paths within the map of file line ranges (#1098)
* Canonicalize file paths within the map of file line ranges

* Forgot to run the tests - and of course, the formatting of the canonicalization change was off, but it's fixed now!

* Move imports to the top of the file, as per @nrc.

* Change `canonicalize_path_string` to return `Option<String>`, `None` indicating an error rather than an empty string

* `format!` is better than string concatenation...

* Change `canonicalize_path_string` to return `Result` rather than `Option`
2016-07-19 09:05:01 +12:00
Nick Cameron
25f973224c Merge pull request #1100 from studoot/add-appveyor-support
Add Appveyor CI support
2016-07-18 08:04:23 +12:00
Stuart Dootson
c917462a92 Add appveyor CI support 2016-07-15 11:17:15 +01:00
Nick Cameron
ca2debdcb1 Merge pull request #1088 from sinkuu/issue_1086
Fix formatting empty block comments (`/**/`)
2016-07-11 10:24:53 +12:00
sinkuu
0dc3fc7a2c Fix formatting empty block comments (/**/)
issue #1086
2016-07-09 22:56:50 +09:00
Nick Cameron
ffa5a22d1c Merge pull request #1084 from johannhof/rustfmt-not-found
Show more helpful error if rustfmt is not in PATH.
2016-07-04 21:30:52 +12:00
Johann Hofmann
033741246c
Show more helpful error if rustfmt is not in PATH.
This fixes #1071.
2016-07-04 07:42:18 +02:00
Nick Cameron
b51bcbfbef Merge pull request #1083 from KaivoAnastetiks/fix/easy-issue-repo
Links to the rust-lang-nursery/rustfmt issue list.
2016-07-04 15:57:00 +12:00
Nick Cameron
ddda46d265 rustup 2016-07-04 15:46:58 +12:00
Kaivo Anastetiks
a9d27f92ce Links to the rust-lang-nursery/rustfmt issue list. 2016-07-02 11:34:48 -04:00
Nick Cameron
7c70254fd8 Merge pull request #1075 from johannhof/diff-exit
Return failure exit code on found diffs (fix #906)
2016-06-23 10:24:19 +12:00
Johann Hofmann
8260d277c8
Return failure exit code on found diffs (fix #906)
This changes rustfmt to return exit code 4
when run with write mode diff and differences between
the formatted code and the original code are found.

Useful for CI to make sure your contributors actually ran rustfmt.
2016-06-21 23:01:15 +02:00
Nick Cameron
48a37713f9 Merge pull request #1064 from dato/patch-2
Fix typo in path: ~/cargo/bin → ~/.cargo/bin
2016-06-16 10:35:00 +02:00
Dato Simó
7c5efd7437 Fix typo in path: ~/cargo/bin → ~/.cargo/bin 2016-06-15 00:48:58 -03:00
Nick Cameron
664bf3eae7 Merge pull request #1054 from sanxiyn/loop-width
Fix width computation in Loop::rewrite
2016-06-14 08:32:02 +02:00
Seo Sanghyeon
921b563847 Fix width computation in Loop::rewrite 2016-06-12 20:37:15 +09:00
Kamal Marhubi
5361f61110 Include git commit and worktree status in version output (#1060)
This will help in debugging issues as rustfmt gets more users.

If the working tree is clean, output looks like

    $ target/debug/rustfmt -V
    0.5.0 (9f5ed3b)

If the working tree is dirty, output looks like

    $ target/debug/rustfmt -V
    0.5.0 (9f5ed3b worktree dirty)

If git is unavailable, output looks like

    $ target/debug/rustfmt -V
    0.5.0 (git commit unavailable)

To avoid rebuilds on changing tests, the build script will only rerun if
files under src/ are changed. This means the actual git status may show
changed files and this would not show up in the version. This should not
be an issue as files not in src/ should not affect the build output.
2016-06-12 10:38:03 +02:00
Nick Cameron
1743f5caf6 Merge pull request #1061 from marcusklaas/fix-subtract2
Fix integer underflow in extra_offset
2016-06-10 17:23:40 +02:00
Marcus Klaas
88fdf9a6e3 Fix integer underflow in extra_offset 2016-06-10 16:17:10 +02:00
Nick Cameron
931e71eb43 Merge pull request #1059 from marcusklaas/fix-subtract
Fix integer underflow
2016-06-10 16:00:46 +02:00
Marcus Klaas
1b55aa9f10 Fix integer underflow 2016-06-10 15:19:06 +02:00