]>
git.lizzy.rs Git - rust.git/log
Kamal Marhubi [Tue, 31 May 2016 13:15:33 +0000 (15:15 +0200)]
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.
Nick Cameron [Tue, 31 May 2016 07:45:45 +0000 (08:45 +0100)]
Merge pull request #1007 from kamalmarhubi/basic-line-ranges-v2
Add infrastructure for formatting specific line ranges
Kamal Marhubi [Mon, 30 May 2016 22:42:14 +0000 (00:42 +0200)]
README: Explain that --file-lines ranges are 1-based
Kamal Marhubi [Mon, 30 May 2016 14:41:43 +0000 (16:41 +0200)]
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.
Kamal Marhubi [Mon, 30 May 2016 14:10:26 +0000 (16:10 +0200)]
codemap: Add module description
Kamal Marhubi [Mon, 30 May 2016 14:10:12 +0000 (16:10 +0200)]
Add copyright notices to added files
Kamal Marhubi [Sun, 10 Apr 2016 17:03:54 +0000 (13:03 -0400)]
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
Kamal Marhubi [Sat, 12 Mar 2016 00:19:16 +0000 (19:19 -0500)]
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
Kamal Marhubi [Thu, 26 May 2016 12:17:20 +0000 (14:17 +0200)]
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
Kamal Marhubi [Thu, 26 May 2016 11:49:19 +0000 (13:49 +0200)]
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
Kamal Marhubi [Wed, 25 May 2016 18:41:26 +0000 (20:41 +0200)]
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
Kamal Marhubi [Wed, 25 May 2016 18:41:26 +0000 (20:41 +0200)]
visitor: Add debug log for FmtVisitor::visit_stmt()
Kamal Marhubi [Wed, 25 May 2016 18:41:26 +0000 (20:41 +0200)]
Derive Debug for the Input enum
Nick Cameron [Mon, 30 May 2016 13:57:29 +0000 (01:57 +1200)]
Merge pull request #1017 from marcusklaas/tweak-if-else
Format non-statement if-else expressions on a single line
Nick Cameron [Mon, 30 May 2016 13:25:09 +0000 (01:25 +1200)]
Merge pull request #1022 from kamalmarhubi/update-syntex-syntax
deps: Update syntex_syntax to 0.33
Nick Cameron [Mon, 30 May 2016 13:24:07 +0000 (01:24 +1200)]
Merge pull request #1015 from srinivasreddy/readme
Add section - Installing from source
Kamal Marhubi [Mon, 30 May 2016 12:53:04 +0000 (14:53 +0200)]
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
Marcus Klaas [Sun, 29 May 2016 15:58:38 +0000 (17:58 +0200)]
Format non-statement if-else expressions on a single line
Srinivas Reddy Thatiparthy [Sat, 28 May 2016 15:38:33 +0000 (21:08 +0530)]
Add section - Installing from source
Kamal Marhubi [Fri, 27 May 2016 22:58:25 +0000 (00:58 +0200)]
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.
Nick Cameron [Fri, 27 May 2016 22:08:00 +0000 (10:08 +1200)]
Merge pull request #1008 from rust-lang-nursery/hrtb
Don't ignore universal quantification in function types
Nick Cameron [Thu, 26 May 2016 22:39:28 +0000 (10:39 +1200)]
Don't ignore universal quantification in function types
Fixes #1006
Nick Cameron [Fri, 27 May 2016 22:04:04 +0000 (10:04 +1200)]
Merge pull request #1009 from rust-lang-nursery/fn-args-1
Fix off by 2 error in function sigs
Nick Cameron [Thu, 26 May 2016 23:49:26 +0000 (11:49 +1200)]
Fix off by 2 error in function sigs
Fixes #1000
This is a little conservative in some cases, but better than being wrong in others.
Nick Cameron [Fri, 27 May 2016 08:33:19 +0000 (20:33 +1200)]
Don't put a newline before `?` when it is the second sub-expression in a chain (#1012)
Fixes #1003
Nick Cameron [Wed, 18 May 2016 20:38:49 +0000 (08:38 +1200)]
Optionally put short struct variants on one line (#997)
Closes #418
Nick Cameron [Wed, 18 May 2016 20:36:59 +0000 (08:36 +1200)]
Format inline attributes on out-of-line modules (#996)
Fixes #838
Nick Cameron [Tue, 17 May 2016 22:02:04 +0000 (10:02 +1200)]
Merge branch 'master' of github.com:rust-lang-nursery/rustfmt
Nick Cameron [Tue, 17 May 2016 21:58:51 +0000 (09:58 +1200)]
Handle parser errors better
Nick Cameron [Tue, 17 May 2016 21:25:57 +0000 (09:25 +1200)]
Fall back to basic stdout if we can't unwrap a fancy terminal (#995)
fixes #978
Nick Cameron [Sun, 15 May 2016 22:15:29 +0000 (10:15 +1200)]
Merge pull request #992 from srinivasreddy/master
change normalise spelling to American version -
Nick Cameron [Sun, 15 May 2016 22:09:53 +0000 (10:09 +1200)]
Note in te README about compiler version
Closes #990
Srinivas Reddy Thatiparthy [Sun, 15 May 2016 16:49:44 +0000 (22:19 +0530)]
change normalise spelling to American version - normalize as American english is more common across programming community
Nick Cameron [Sun, 15 May 2016 09:41:05 +0000 (21:41 +1200)]
Write each file as it is formatted (#991)
The old behaviour stored everything in memory until we were finished. Now we write as soon as we can.
This gives better behaviour when formatting large programs, since there is some progress indication. It also opens the door to optimising memory use by not storing everything in memory unless it is required (which it still might be). That is left as future work though.
Nick Cameron [Fri, 13 May 2016 19:34:55 +0000 (12:34 -0700)]
0.5 release
Nick Cameron [Thu, 12 May 2016 23:07:42 +0000 (16:07 -0700)]
Merge pull request #893 from marcusklaas/try-shorthand
Try shorthand
Marcus Klaas [Thu, 12 May 2016 19:50:43 +0000 (21:50 +0200)]
Bootstrap it. Hard.
Marcus Klaas [Mon, 9 May 2016 18:11:25 +0000 (20:11 +0200)]
Add try macro to try shorthand conversion tests
Marcus Klaas [Mon, 9 May 2016 18:07:59 +0000 (20:07 +0200)]
Format try shorthand
Nick Cameron [Fri, 6 May 2016 02:02:56 +0000 (14:02 +1200)]
Merge pull request #981 from DanielJCampbell/generated
Altered FmtVisitor to function correctly on generated code
Daniel Campbell [Fri, 6 May 2016 01:02:42 +0000 (13:02 +1200)]
Altered FmtVisitor to function correctly on generated code
Nick Cameron [Fri, 6 May 2016 01:09:46 +0000 (13:09 +1200)]
Merge pull request #980 from DanielJCampbell/visibility
Changed modules & visitor mods to public, set filemap::write_file public
Daniel Campbell [Fri, 6 May 2016 00:20:38 +0000 (12:20 +1200)]
Changed modules & visitor mods to public, set filemap::write_file public
Nick Cameron [Thu, 5 May 2016 20:59:02 +0000 (08:59 +1200)]
Merge pull request #979 from kamalmarhubi/update-syntex-syntax
deps: Update syntex_syntax to 0.32.0
Kamal Marhubi [Mon, 2 May 2016 03:01:46 +0000 (23:01 -0400)]
deps: Update syntex_syntax to 0.32.0
Nick Cameron [Tue, 3 May 2016 20:32:26 +0000 (08:32 +1200)]
Merge pull request #974 from sanxiyn/unused-trait-import
Remove unused trait imports
Seo Sanghyeon [Tue, 3 May 2016 12:52:55 +0000 (21:52 +0900)]
Remove unused trait imports
Nick Cameron [Tue, 3 May 2016 05:22:50 +0000 (17:22 +1200)]
Merge pull request #973 from habnabit/fix-associated-items
Don't misplace the :: on associated items.
Aaron Gallagher [Tue, 3 May 2016 00:11:22 +0000 (17:11 -0700)]
Don't misplace the :: on associated items.
The rewritten location of the :: on global paths for qpaths was wrong.
Nick Cameron [Mon, 2 May 2016 21:19:50 +0000 (09:19 +1200)]
Merge pull request #971 from kamalmarhubi/update-syntex-syntax
deps: Update syntex_syntax to 0.31.0
Nick Cameron [Mon, 2 May 2016 08:54:25 +0000 (20:54 +1200)]
Handle attributes on modules (#968)
* Handle attributes (including doc comments) on inline modules
Closes #22
Closes #684
* Tweak the rules for changing indentation in comments (to do it less often).
Kamal Marhubi [Mon, 2 May 2016 05:05:23 +0000 (01:05 -0400)]
Handle new visibility types more gracefully
Kamal Marhubi [Mon, 2 May 2016 03:01:46 +0000 (23:01 -0400)]
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
Nick Cameron [Thu, 28 Apr 2016 06:15:22 +0000 (18:15 +1200)]
Merge pull request #966 from MicahChalmer/skip-children-in-plain-write-mode
Always skip children when using Plain write mode
Micah Chalmer [Thu, 28 Apr 2016 05:38:04 +0000 (01:38 -0400)]
Always skip children when using Plain write mode
Outputting child module contents in the "Plain" write mode does not make
sense, since there is no way to differentiate code that came from a
child module from that which came from the parent file.
Nick Cameron [Wed, 27 Apr 2016 21:49:08 +0000 (09:49 +1200)]
Merge pull request #960 from rust-lang-nursery/big-closures
Block indent large closures and field/method chains
Nick Cameron [Wed, 27 Apr 2016 20:08:54 +0000 (08:08 +1200)]
Add visual indent tests for chains
Nick Cameron [Wed, 27 Apr 2016 19:08:44 +0000 (07:08 +1200)]
Bail out on recovered errors. (#965)
Closes #915
Closes #930
Closes #931
Nick Cameron [Tue, 26 Apr 2016 02:27:13 +0000 (14:27 +1200)]
Fix for stable
Nick Cameron [Fri, 22 Apr 2016 07:26:42 +0000 (19:26 +1200)]
Update docs (and a function name)
Nick Cameron [Fri, 22 Apr 2016 07:19:09 +0000 (19:19 +1200)]
Add a bootstrap script for running rustfmt on itself.
Nick Cameron [Fri, 22 Apr 2016 07:03:36 +0000 (19:03 +1200)]
Change defaults and update tests and source
New defaults are `Tabbed` for `chain_indent` and `chain_base_indent`, and `5` for `closure_block_indent_threshold`.
Nick Cameron [Fri, 22 Apr 2016 06:53:39 +0000 (18:53 +1200)]
Tests
Nick Cameron [Fri, 22 Apr 2016 03:35:16 +0000 (15:35 +1200)]
Tabbed/Inherit indent for chains works even without a newline after first item.
Nick Cameron [Fri, 22 Apr 2016 01:36:27 +0000 (13:36 +1200)]
refactor and document the chain reformatting code
Nick Cameron [Thu, 21 Apr 2016 23:29:01 +0000 (11:29 +1200)]
block indent large closures
somewhat rough around the edges
mrBliss [Tue, 19 Apr 2016 18:19:14 +0000 (20:19 +0200)]
Format visibility of associated consts (#953)
Fixes #951.
Nick Cameron [Mon, 18 Apr 2016 19:44:25 +0000 (07:44 +1200)]
Merge pull request #950 from marcusklaas/extern-abi
Add option to force explicit extern ABI's
Marcus Klaas [Mon, 18 Apr 2016 16:39:40 +0000 (18:39 +0200)]
Add option to force explicit extern ABI's
Marcus Klaas de Vries [Sun, 17 Apr 2016 21:15:37 +0000 (23:15 +0200)]
Merge pull request #948 from flutterhash/master
Added option to configure if/else brace style
Thia Wyrod [Sun, 17 Apr 2016 17:01:16 +0000 (11:01 -0600)]
Added loop/match brace style control option
This adds Allman style loop/match braces as an alternative to the current
default style.
Thia Wyrod [Sat, 16 Apr 2016 23:33:17 +0000 (17:33 -0600)]
Added option to configure if/else brace style
Nick Cameron [Sat, 16 Apr 2016 22:23:48 +0000 (10:23 +1200)]
Merge pull request #947 from marcusklaas/match-pattern-limit
Fix off-by-one error in pattern formatting
Marcus Klaas [Sat, 16 Apr 2016 20:42:15 +0000 (22:42 +0200)]
Fix off-by-one error in pattern formatting
Kamal Marhubi [Sat, 16 Apr 2016 20:34:15 +0000 (16:34 -0400)]
rustfmt: Parse options once instead of once per file argument (#944)
`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()`.
Nick Cameron [Sat, 16 Apr 2016 04:42:56 +0000 (16:42 +1200)]
Merge pull request #941 from marcusklaas/type-ascription
Format type ascription
Nick Cameron [Sat, 16 Apr 2016 04:42:17 +0000 (16:42 +1200)]
Merge pull request #942 from marcusklaas/break-continue-fix
Check length of break and continue expressions
Nick Cameron [Sat, 16 Apr 2016 04:41:21 +0000 (16:41 +1200)]
Merge pull request #938 from kamalmarhubi/rename-doc-hint
config: Rename get_variant_names to doc_hint
Marcus Klaas [Fri, 15 Apr 2016 16:11:20 +0000 (18:11 +0200)]
Check length of break and continue expressions
Marcus Klaas [Fri, 15 Apr 2016 15:56:08 +0000 (17:56 +0200)]
Format type ascription
Aleksey Kladov [Fri, 15 Apr 2016 14:52:21 +0000 (17:52 +0300)]
Don't print empty lines to stderr (#940)
Nick Cameron [Fri, 15 Apr 2016 08:52:08 +0000 (20:52 +1200)]
Fix closures again (#937)
* Fix closures again
Closes #934
Oh god, the rules for parsing closures are even more messed up than I thought - whether or not there is an inner block or depends not only on if there are braces, but also if there is a return type for the closure (!) and if there are statements in the block.
* Fix overflow
Kamal Marhubi [Fri, 15 Apr 2016 05:11:04 +0000 (01:11 -0400)]
config: Rename get_variant_names to doc_hint
The `ConfigType` trait is implemented for non-enum types, so the name no
longer makes perfect sense.
Nick Cameron [Fri, 15 Apr 2016 01:50:10 +0000 (13:50 +1200)]
Merge pull request #923 from matklad/proper-exit-code
return non-zero exit code if there are errors
Aleksey Kladov [Thu, 14 Apr 2016 23:51:50 +0000 (02:51 +0300)]
return non-zero exit code if there were errors
Nick Cameron [Thu, 14 Apr 2016 20:13:55 +0000 (08:13 +1200)]
Merge pull request #936 from marcusklaas/licenses
Add license stuff
Nick Cameron [Thu, 14 Apr 2016 20:13:26 +0000 (08:13 +1200)]
Merge pull request #935 from marcusklaas/issue-770
Add regression test for issue 770
Marcus Klaas [Thu, 14 Apr 2016 18:48:21 +0000 (20:48 +0200)]
Add license stuff
Marcus Klaas de Vries [Thu, 14 Apr 2016 18:42:38 +0000 (20:42 +0200)]
Fix brace indentation for impl items (#927)
Marcus Klaas [Thu, 14 Apr 2016 18:41:23 +0000 (20:41 +0200)]
Add regression test for issue 770
Nick Cameron [Wed, 13 Apr 2016 23:42:25 +0000 (11:42 +1200)]
Merge pull request #928 from matklad/patch-1
don't silence error unnecessary
Aleksey Kladov [Wed, 13 Apr 2016 22:39:39 +0000 (01:39 +0300)]
don't silence error unnecessary
This `if` was used to separate error output from the formatting output, when they both used stdout. It was useful for integration with tools, which can submit input to stdin and read pretty printed result from stdout without worrying about errors intermingled with the actual result.
But now we write errors to `stderr`, so the problem disappears and we can safely remove this `if`.
Errors should never pass silently, unless explicitly silenced.
Nick Cameron [Wed, 13 Apr 2016 21:32:30 +0000 (09:32 +1200)]
Merge pull request #926 from rust-lang-nursery/closures
Be careful about where we change braces in closures
Nick Cameron [Wed, 13 Apr 2016 20:36:59 +0000 (08:36 +1200)]
Be careful about where we change braces in closures
And some general refactoring of closure code.
Fixes #863
Nick Cameron [Wed, 13 Apr 2016 20:40:55 +0000 (08:40 +1200)]
Merge pull request #914 from kamalmarhubi/invalid-operation-result
rustfmt: Make error handling more idiomatic
Srinivas Reddy Thatiparthy [Wed, 13 Apr 2016 19:22:45 +0000 (00:52 +0530)]
Change stdout to stderr (#925)
Nick Cameron [Mon, 11 Apr 2016 23:05:06 +0000 (11:05 +1200)]
Merge pull request #921 from matklad/more-unification
unify format_string and format_file
Nick Cameron [Mon, 11 Apr 2016 23:04:33 +0000 (11:04 +1200)]
Fix the build
Nick Cameron [Mon, 11 Apr 2016 22:48:08 +0000 (10:48 +1200)]
Merge pull request #918 from rust-lang-nursery/ty-variadic
Handle variadic function types
Nick Cameron [Mon, 11 Apr 2016 09:20:03 +0000 (21:20 +1200)]
Handle variadic function types
Closes #842