Commit Graph

1112 Commits

Author SHA1 Message Date
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
Marcus Klaas de Vries
c31a366f0b Merge pull request #1042 from imjacobclark/1014-refactoring-vector-string-to-join
Refactor string collects to itertools join
2016-06-07 20:21:54 +02:00
Jacob Clark
77edbb7def
Refactoring exsisting filter_maps to maps 2016-06-07 00:03:25 +01:00
Jacob Clark
2ea99869a7
Refactor string collects to itertools join 2016-06-06 22:30:40 +01:00
Nick Cameron
3d4bc8c84a Merge pull request #1033 from marcusklaas/assignment-break
Add test for general assignment breaks
2016-06-05 18:06:08 +01:00
Nick Cameron
e7294285f0 Merge pull request #1032 from marcusklaas/else-if-let-overflow
Fix constraints on pattern formatting of else arms
2016-06-05 18:05:19 +01:00
Marcus Klaas
05188deadc Add test for general assignment breaks 2016-06-04 11:00:01 +02:00
Marcus Klaas
b3488c6186 Fix constraints on pattern formatting of else arms 2016-06-03 23:18:19 +02:00
Nick Cameron
728eb0005f Merge pull request #1030 from nokaa/master
Update Vim integration instructions
2016-06-03 10:06:56 +01:00
nokaa
af4a9fa6f6
Update Vim integration instructions 2016-06-03 02:52:48 -05:00
Nick Cameron
0087306761 Merge pull request #1016 from rust-lang-nursery/try-double-indent
Treat chains with just expr? specially.
2016-06-01 12:28:36 +01:00
lqd
b6263735b1 Add support for the default keyword (#1025)
Adds support for Defaultness on impl methods.
Fixes #945
2016-05-31 19:48:49 +02:00
Nick Cameron
d19844d492 Merge pull request #1023 from kamalmarhubi/diff-color-fix
print_diff: Don't print color codes if output is not a tty
2016-05-31 15:27:11 +01:00
Kamal Marhubi
9759068e62 print_diff: Don't print color codes if output is not a tty
On unix, `term::stdout()` just reads the `TERM` environment variable to
decide what features are available. It does not check if the output file
descriptor is in fact a tty. This resulted in printing escape codes when
redirecting output.
2016-05-31 15:15:33 +02:00
Nick Cameron
240dba5467 Merge pull request #1007 from kamalmarhubi/basic-line-ranges-v2
Add infrastructure for formatting specific line ranges
2016-05-31 08:45:45 +01:00
Kamal Marhubi
e252100cf6 README: Explain that --file-lines ranges are 1-based 2016-05-31 01:35:54 +02:00
Kamal Marhubi
66483017f6 Explain that FileLines cannot be given in rustfmt.toml
This adds a note to both the `--config-help` output for `file_lines`,
and to the panic message on attempting to deserialize a `FileLines`
struct.
2016-05-31 01:35:18 +02:00
Kamal Marhubi
8775fe4172 codemap: Add module description 2016-05-31 01:34:42 +02:00
Kamal Marhubi
a83f1a197e Add copyright notices to added files 2016-05-31 01:34:07 +02:00
Kamal Marhubi
bef5d095a4 rustfmt: Add option to specify line ranges for formatting
This commit adds the `--experimental-file-lines` option to rustfmt. This
allows specifying line ranges to format from the command line.

Refs #434
2016-05-31 01:33:58 +02:00
Kamal Marhubi
9fa5a91fc5 visitor: Handle specified line ranges in visit_stmt
This commit adds a very rough implementation of handling the specified
line ranges in `config.file_lines_map` for statements. It reformats a
statement if its span is fully contained in the set of lines specified
for the file.

The implementation here is intended as a proof of concept, and
demonstration that the machinery added in the preceding commits is
functional. A final implementation would likely hook in via the
`Rewrite` trait.

Refs #434
2016-05-31 01:33:11 +02:00
Kamal Marhubi
c311b30cac Add type to represent collection of lines in files
This commit adds a type to represent lines in files, and adds it to the
`Config` struct. It will be used for restricting formatting to specific
lines.

Refs #434
2016-05-31 01:24:38 +02:00
Kamal Marhubi
ed27b4799a codemap: Add utilities for looking up line ranges of spans
This commit adds extension methods to `Codemap` to allow looking up line
ranges for spans.

Refs #434
2016-05-31 00:49:31 +02:00
Kamal Marhubi
bd10af127e utils: Move codemap related utilities to a dedicated module
This commit adds a `codemap` module, and moves the `CodemapSpanUtils`
added in #857 to it. This is preparation for adding more `Codemap`
specific utilities.

Refs #434
2016-05-31 00:49:26 +02:00
Kamal Marhubi
80c56a01ff visitor: Add debug log for FmtVisitor::visit_stmt() 2016-05-31 00:43:48 +02:00
Kamal Marhubi
7f0d87cc51 Derive Debug for the Input enum 2016-05-31 00:43:48 +02:00
Nick Cameron
5436977bd5 Merge pull request #1017 from marcusklaas/tweak-if-else
Format non-statement if-else expressions on a single line
2016-05-31 01:57:29 +12:00