Commit Graph

1102 Commits

Author SHA1 Message Date
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
Nick Cameron 3a87aa5318 Merge pull request #1022 from kamalmarhubi/update-syntex-syntax
deps: Update syntex_syntax to 0.33
2016-05-31 01:25:09 +12:00
Nick Cameron 0678152e73 Merge pull request #1015 from srinivasreddy/readme
Add section - Installing from source
2016-05-31 01:24:07 +12:00
Kamal Marhubi 120e1a0b51 deps: Update syntex_syntax to 0.33
This bump brings syntex_syntax support for `..` in tuple and tuple
struct patterns, which come from RFC 1492:
  https://github.com/rust-lang/rfcs/blob/master/text/1492-dotdot-in-patterns.md

These new patterns are not properly handled in this PR; instead #1021
tracks supporting them.

Refs #1021
2016-05-30 14:53:04 +02:00
Marcus Klaas 98c0570a28 Format non-statement if-else expressions on a single line 2016-05-29 17:58:38 +02:00
Nick Cameron bbb6038b92 Treat chains with just expr? specially.
Fixes #1004
2016-05-29 09:32:48 +01:00
Srinivas Reddy Thatiparthy 18489b3648 Add section - Installing from source 2016-05-28 21:08:33 +05:30
Kamal Marhubi 66cac1f3e9 Handle pub(restricted) (#1013)
* Handle pub(restricted)

This commit properly handles pub(restricted) as introduced in RFC 1422
[0]. The syntax support was added in #971, but they were not correctly
formatted.

[0] https://github.com/rust-lang/rfcs/blob/master/text/1422-pub-restricted.md

Fixes #970

* Drop #[inline] attribute on format_visibility

* Make newly non-failing functions return String

The change to `format_visibiilty` means that `format_header` and
`format_unit_struct` can no longer fail. Their return type is updated to
reflect that.
2016-05-28 00:58:25 +02:00
Nick Cameron 6e01fac285 Merge pull request #1008 from rust-lang-nursery/hrtb
Don't ignore universal quantification in function types
2016-05-28 10:08:00 +12:00
Nick Cameron 0fae34dfa1 Don't ignore universal quantification in function types
Fixes #1006
2016-05-27 15:09:04 -07:00
Nick Cameron d633e831ba Merge pull request #1009 from rust-lang-nursery/fn-args-1
Fix off by 2 error in function sigs
2016-05-28 10:04:04 +12:00