Commit Graph

339 Commits

Author SHA1 Message Date
Nick Cameron
4418fab4f2 Update to latest Syntex
+ Cargo update
+ 0.6.2 release
2016-09-16 15:28:02 +12:00
Nick Cameron
d022f05f34 v0.6.0 2016-08-11 10:08:59 +12: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
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
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
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
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
67edc325c6 0.5 release 2016-05-13 12:34:55 -07:00
Kamal Marhubi
8309d1a74c deps: Update syntex_syntax to 0.32.0 2016-05-05 16:39:34 -04:00
Kamal Marhubi
fd38acb86f deps: Update syntex_syntax to 0.31.0
Most of the churn on this bump comes from the `Visibility` enum changing
from

    pub enum Visibility {
        Public,
        Inherited,
    }

to

    pub enum Visibility {
        Public,
        Crate,
        Restricted { path: P<Path>, id: NodeId },
        Inherited,
    }

which require taking `Visibility` by reference in most places. The new
variants are not handled at this point.

Refs #970
2016-05-01 23:06:58 -04:00
Nick Cameron
19849fea15 Update the world 2016-04-08 15:51:06 +12:00
Nick Cameron
19768da5c9 Version bump - v0.4
closes #870
2016-03-30 15:19:46 +13:00
Kamal Marhubi
f2b5931c6d deps: Update syntex_syntax to 0.30.0
This bump includes ability to parse inclusive ranges (`a...b`) and the
question mark operator.

Refs #867, #890
2016-03-29 00:04:44 -04:00
Kamal Marhubi
589dabda2f deps: Update syntex_syntax to 0.29.1 2016-03-02 13:08:21 -05:00
Nick Cameron
82a177e486 Version bump
Fixes #805
2016-02-09 17:28:45 +13:00
Utkarsh Kukreti
6a12818c23 Bump diff to 0.1.8. Fixes #606. 2015-12-28 17:22:03 +05:30
Nick Cameron
ecf12778fb Use replace rather than overwrite for cargo fmt 2015-12-16 18:07:59 +13:00
Nick Cameron
909b3560ba Add quick start info to README.md, cargo update. 2015-12-16 17:58:20 +13: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
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
Nick Cameron
78957d371e Use crates.io for everything 2015-12-14 08:03:58 +13:00
Nick Cameron
e94bd34a06 cargo upgrade, bug fix, and prepare for packaging 2015-12-08 16:19:23 +13:00
Alex Crichton
26958a1c10 Move option parsing to crates.io-based getopts crate
Should help adding more options in the future as well!
2015-10-23 13:46:14 -07:00
Alex Crichton
579fb34417 Remove dependence on rustc/rustc_driver, use syntex
Instead just parse manually with the `syntex_syntax` crate which is a clone of
libsyntax on crates.io which builds on stable Rust.
2015-10-23 13:46:14 -07:00
Alex Crichton
cda463275e Use the log/env_logger crates from crates.io 2015-10-23 13:46:14 -07:00
Steve Klabnik
67e5c28fd9 Use newer style in Cargo.toml
This keeps everything under dependencies, which is nice.
2015-10-08 11:09:54 -04:00
Marcus Klaas
da3d2f57da Bump diff.rs version
This should make the computation of diffs quite a bit faster, which is particularly noticable in tests.
2015-09-14 20:22:07 +02:00
Sinh Pham
e7a5f9327e Add diff write mode https://github.com/nrc/rustfmt/issues/261 2015-09-10 18:30:07 -04:00
Sinh Pham
e47646b44b Small style fixes. 2015-09-09 07:56:56 -04:00
Sinh Pham
61f642f6f8 Support unicode in string literals. 2015-09-03 23:41:25 -04:00
Marcus Klaas
adeafb3e45 Refactor diff handling in tests
This splits the generation and display of mismatches. Mismatches now include a few lines of context. Finally, diffs are now coloured.
2015-08-30 22:31:26 +02:00
Simon Bernier St-Pierre
9ead47151e Add project-specific configuration file support 2015-08-25 19:05:30 -04:00
Marcus Klaas
98c9c6e9ef implement framework for system tests 2015-06-05 17:50:22 +02:00
Nick Cameron
1a09a6d00a Use config file for constants 2015-05-23 17:53:53 +12:00
Nick Cameron
aa6f7e8d3c Add default.toml and modify the build system for it 2015-05-23 15:28:41 +12:00
Marcus Klaas
4ecde410c4 Show diffs for failing tests 2015-05-12 02:19:14 +02:00
Tobias Bucher
2145108043 Rename src/mod.rs to src/main.rs to adhere to the standard crate format 2015-04-30 13:37:09 +02:00
Nick Cameron
8f5b899c85 Use strings.rs rather than local modules 2015-04-14 13:13:35 +12:00
Nick Cameron
7417ab5aed Working prototype
Implements a few formatting options using an approach where we modify the source using a rope. Uses very ad-hoc rules for formatting.
2015-03-08 11:46:35 +13:00