about summary refs log tree commit diff
path: root/src/bin
AgeCommit message (Collapse)AuthorLines
2017-05-30Expose methods to locate and load configRavi Khadiwala-83/+13
* Make method for searching parents for toml file public * Make method for loading config from path directly public, tweak the API since it was never returning None
2017-05-25Simplify --version infoNick Cameron-13/+3
2017-05-18Add --dump-default-config and --dump-minimal-config.Michael Killough-1/+39
- `--dump-default-config` outputs the default configuration to the specified file as TOML and then exits. - `--dump-minimal-config` is checked after formatting files as normal. If present, any configuration options that were checked during formatting are written to the specified file as TOML. - These options were added only to `rustfmt`, not to `cargo fmt`. They can be specified when using `cargo fmt` by placing them after `--`. - It would have been nice if the filename was optional, so you could run just `rusfmt --dump-minimal-config build.rs` to have it output to `rustfmt.toml`. However, this doesn't do what you might expect: it outputs the config to `build.rs`!
2017-05-18Provide `config.set().item(value)` API.Michael Killough-28/+28
This API isn't fantastic, but it's the best I can come up with without something like `concat_idents!()`. There are relatively few places where config is set, to hopefully the ugliness isn't disastrous. Change previous occurences of `config.item = value` to this new API, rather than using `config.override_value()`. Undo the changes to `override_value()`, as it's no longer important to propogate the error to the caller. Add a test for the new interface.
2017-05-16Switch to accessing config items via method.Michael Killough-29/+29
Preparation for #865, which proposes adding a flag which outputs which config options are used during formatting. This PR should not make any difference to functionality. A lot of this was search-and-replace. Some areas worthy of review/discussion: - The method for each config item returns a clone of the underlying value. We can't simply return an immutable reference, as lots of places in the code expect to be able to pass the returned value as `bool` (not `&bool). It would be nice if the `bool` items could return a copy, but the more complex types a borrowed reference... but unfortunately, I couldn't get the macro to do this. - A few places (mostly tests and `src/bin/rustfmt.rs`) were overriding config items by modifying the fields of the `Config` struct directly. They now use the existing `override_value()` method, which has been modified to return a `Result` for use by `src/bin/rustfmt.rs`. This benefits of this are that the complex `file_lines` and `write_mode` strings are now parsed in one place (`Config.override_value`) instead of multiple. The disadvantages are that it moves the compile-time checks for config names to become run-time checks.
2017-05-08Replace 'try!' with '?'topecongiro-16/+16
2017-05-08Allow config-path to point to a filetopecongiro-22/+40
2017-05-03Drop rustc-serialize, use serde, update toml dependencyest31-11/+17
2017-05-01Merge pull request #1473 from topecongiro/bug/no-such-file-or-directoryNick Cameron-12/+20
Prevent panicking against directories or non-existent files
2017-04-26Prevent panicking against directories or non-existent filesSeiichi Uchida-12/+20
2017-04-19Show exit codes' meanings with the rustfmt help messageSheng Hau-0/+1
2017-04-10fix path checkJay Lee-1/+10
2017-04-06Merge pull request #1438 from topecongiro/poor-formatting/method-chainsNick Cameron-1/+2
Lookup the last element of 'subexpr_list' instead of the first one
2017-04-06Lookup the last element of 'subexpr_list' instead of the first onetopecongiro-1/+2
Closes #1217, #1236, #1389 and #1434.
2017-04-06Merge pull request #1432 from topecongiro/parse-configNick Cameron-7/+8
Print error and usage when decoding config file failed
2017-04-03Change return type of 'from_toml' from 'Config' to 'Result<Config>'topecongiro-7/+8
Closes #1426.
2017-04-03Merge pull request #1430 from fintelia/stdin_linesNick Cameron-10/+18
The --file_lines argument now supports "stdin"
2017-03-31Warn about extra files listed in file_lines argumentJonathan Behrens-0/+11
2017-03-30--file_lines argument now supports "stdin"Jonathan Behrens-11/+8
2017-03-30Implemented support for workspacesEmil Gardström-16/+96
closes rust-lang-nursery/rustfmt#1244
2017-03-28test falloutNick Cameron-35/+8
2017-03-28fallout - source reformattingNick Cameron-3/+11
2017-03-28Source formatting falloutNick Cameron-6/+12
2017-03-22Test and source falloutNick Cameron-1/+4
2017-03-07Formatting falloutNick Cameron-5/+20
Also fixes a minor bug when we break a line after `if` and used to leave a trailing space
2017-02-23more falloutNick Cameron-5/+5
2017-02-23test falloutNick Cameron-8/+8
2017-02-13Don't print config file by default (#1313)Casey Rodarmor-7/+12
Supress `Using rusftmt config file...` messages unless the --verbose flag is given.
2017-01-25Process build scriptsIvan Ukhov-1/+3
2016-12-16Recognize "rlib" and "cdylib" crates (#1238)Jason Dusek-1/+1
Addresses #828 and https://github.com/lunaryorn/emacs-module.rs/issues/4 and probably numerous others.
2016-11-21update Serde, etc.Nick Cameron-12/+7
Lots of changes to how closures work
2016-11-02cargo-fmt processes bench, test, example filesMason Smith-11/+11
2016-08-29Run clippysinkuu-7/+7
2016-08-01Multiple config file names feature (#1101)Daniel Campoverde-11/+15
* 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-07-04Merge pull request #1084 from johannhof/rustfmt-not-foundNick Cameron-1/+11
Show more helpful error if rustfmt is not in PATH.
2016-07-04Show more helpful error if rustfmt is not in PATH.Johann Hofmann-1/+11
This fixes #1071.
2016-07-04rustupNick Cameron-2/+1
2016-06-21Return failure exit code on found diffs (fix #906)Johann Hofmann-0/+3
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-12Include git commit and worktree status in version output (#1060)Kamal Marhubi-5/+13
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-05-31rustfmt: Add option to specify line ranges for formattingKamal Marhubi-5/+21
This commit adds the `--experimental-file-lines` option to rustfmt. This allows specifying line ranges to format from the command line. Refs #434
2016-04-22Change defaults and update tests and sourceNick Cameron-15/+15
New defaults are `Tabbed` for `chain_indent` and `chain_base_indent`, and `5` for `closure_block_indent_threshold`.
2016-04-22TestsNick Cameron-10/+7
2016-04-16rustfmt: Parse options once instead of once per file argument (#944)Kamal Marhubi-19/+36
`update_config()` was parsing the `write-mode` option once for each file argument. This commit parses them once up front into a `CliOptions` struct, which is then applied to the config before calling `run()`.
2016-04-15return non-zero exit code if there were errorsAleksey Kladov-6/+22
2016-04-10rustfmt: Simplify match in project file lookup loopKamal Marhubi-8/+6
This commit changes the match in `lookup_project_file` to use pattern guards.
2016-04-10rustfmt: Make error handling more idiomaticKamal Marhubi-50/+35
This commit replaces the `Operation::InvalidInput` variant with `Result`, and uses the `try!()` macro instead of explicit matching.
2016-04-10rustfmt: Move getopts::Options creation to its own functionKamal Marhubi-1/+7
2016-04-06use std::error instead std::outSrinivas Reddy Thatiparthy-9/+1
2016-04-05Merge pull request #897 from matklad/refactor-runNick Cameron-3/+3
Refactor run family of functions
2016-04-04Fix. rustfmt write to stderr instead stdout0x0G-4/+4
Fix. rustfmt write to stderr instead stdout