about summary refs log tree commit diff
path: root/src/patterns.rs
AgeCommit message (Collapse)AuthorLines
2017-06-06Update syntex_syntaxest31-3/+3
Bases on commit to switch to libsyntax by @nrc
2017-05-25Format source codestopecongiro-4/+4
2017-05-23Format source codestopecongiro-1/+1
2017-05-19Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into ↵Michael Killough-1/+1
config
2017-05-18config: fix `suffices` -> `suffixes` typoBen Boeckel-1/+1
Fixes #1477.
2017-05-18Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into ↵Michael Killough-12/+9
config
2017-05-16Format source codestopecongiro-12/+9
2017-05-16Switch to accessing config items via method.Michael Killough-10/+13
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-15Use offset_left for rewrite_unary_prefixSeiichi Uchida-4/+2
2017-05-13Add a missing trailing comma before elipsestopecongiro-2/+8
2017-05-01Merge pull request #1469 from topecongiro/bug/chainsNick Cameron-7/+3
Remove a bug when calculating the length of the chain
2017-04-24Format source codestopecongiro-7/+3
2017-04-15Add heuristic choosing block or visual indent for unary op based on spantopecongiro-2/+4
2017-03-28test falloutNick Cameron-10/+3
2017-03-28fallout - source reformattingNick Cameron-19/+33
2017-03-27Merge pull request #1409 from alobb/1408-empty-tuple-enum-declNick Cameron-47/+46
Prevent conversion of empty tuples to unit structs
2017-03-26Prevent conversion of empty tuples to unit structsAaron Lobb-47/+46
Fixes #1408
2017-03-26Avoid extra comma in vertical single-field struct patterns (#1403)Jon Gjengset-3/+9
* Add (failing) test for #1397 * Fix for #1397 Specifically, we end up double-adding a trailing comma for single-member struct patterns that are arranged vertically. One is added by write_list (since such structs return true for needs_trailing_separator), and another is added by the if in the old code.
2017-03-22Block indenting for struct lit patternsNick Cameron-44/+70
Now follows struct_lit_style (and most other struct_lit_ options). Required a fair bit of refactoring and bug fixes. Fixes #1311
2017-03-09Be smarter about finding the span for `..` in patternsNick Cameron-2/+13
Fixes #1319
2017-03-07Formatting falloutNick Cameron-10/+10
Also fixes a minor bug when we break a line after `if` and used to leave a trailing space
2017-02-26bump syntex_* to 0.58Igor Gnatenko-3/+10
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2017-02-23FalloutNick Cameron-26/+27
2017-02-21WIPNick Cameron-5/+5
2017-01-31Refactor indent and width into Shape structNick Cameron-65/+58
2017-01-20Update to latest SyntexNick Cameron-4/+11
As a side-effect of the Path changes, we are now a bit more aggressive about normalising paths.
2016-11-21update Serde, etc.Nick Cameron-1/+1
Lots of changes to how closures work
2016-11-07Condense suffix strings of simple wildcards in patternsMarcus Klaas-10/+39
2016-10-18Add spaces_within_square_brackets config option. (#1191)Mikko Rantanen-1/+5
* Add spaces_within_square_brackets config option. Enabling the config enforces spaces within various array/slice brackets. * Fixed budget-calculations for [] spacing
2016-10-13Add support for spaces_within_parens config (#1187)Mikko Rantanen-2/+12
* Add support for spaces_within_parens config * Changes based on review comments
2016-09-16Update to latest SyntexNick Cameron-4/+3
+ Cargo update + 0.6.2 release
2016-09-09Fix #1021: Handle `..` in tuple / tuple struct patternssinkuu-40/+93
2016-08-29Run clippysinkuu-1/+1
2016-05-31utils: Move codemap related utilities to a dedicated moduleKamal Marhubi-1/+2
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-31Merge pull request #1017 from marcusklaas/tweak-if-elseNick Cameron-5/+1
Format non-statement if-else expressions on a single line
2016-05-30deps: Update syntex_syntax to 0.33Kamal Marhubi-5/+10
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-29Format non-statement if-else expressions on a single lineMarcus Klaas-5/+1
2016-05-27Don't ignore universal quantification in function typesNick Cameron-1/+0
Fixes #1006
2016-05-12Bootstrap it. Hard.Marcus Klaas-4/+2
2016-04-22Change defaults and update tests and sourceNick Cameron-5/+4
New defaults are `Tabbed` for `chain_indent` and `chain_base_indent`, and `5` for `closure_block_indent_threshold`.
2016-04-16Fix off-by-one error in pattern formattingMarcus Klaas-2/+3
2016-03-14Merge pull request #857 from kamalmarhubi/codemap-extNick Cameron-3/+3
utils: Add CodeMapExt extension trait for span_* methods
2016-03-13utils: Add CodeMapSpanUtils trait for span_* methodsKamal Marhubi-3/+3
This commit adds a CodeMapSpanUtils extension trait on CodeMap, and moves some functions to methods there: - span_after - span_after_last - span_before This better reflects them being lookup methods on the codemap.
2016-03-02deps: Update syntex_syntax to 0.29.1Kamal Marhubi-15/+16
2016-02-15reviewer changesNick Cameron-10/+16
2016-02-12Format all patterns (well, except macros)Nick Cameron-33/+120
Fixes #18 Fixes #672
2015-12-06Fixed named arguments in bare function typesMarcus Klaas-1/+7
2015-11-20Unwrap match arms that are simple blocksMarcus Klaas-6/+2
2015-11-16RustupNick Cameron-8/+4
2015-11-14Pass in whether an ast::Path is in an expression context.Eli Friedman-2/+7
This gets rid of a slightly nasty hack involving scanning the source expression for a ":".