Commit Graph

240 Commits

Author SHA1 Message Date
Nick Cameron
fa3cadf62c
Use width_heuristics in the options docs
It was using an older name
2018-10-23 14:59:14 +13:00
Seiichi Uchida
b2de574848 Add format_doc_comments 2018-10-11 23:34:36 +09:00
Ivan Molodetskikh
cbaed838d5
No trailing comma in struct literals (Visual) 2018-10-06 10:59:47 +03:00
moxian
65ae0b9a09 Change enum align semantics to care about absolute length, rather than difference.
If we're only aligning enum discriminants that are "not too far apart
(length-wise)", then this works really well for enums with
consistently-long or consistently-short idents, but not for the mixed
ones.
However, consistently-long idents is somewhate of an uncommon case and
overlong idents may be allowed to be formatted suboptimally if that
makes mixed-length idents work better (and it does in this case).
2018-09-26 18:47:17 +00:00
moxian
cc22869fb4 Add option to vertically align enum discriminants. 2018-09-26 14:35:38 +00:00
Nick Cameron
1739041f03
Merge pull request #3002 from lqd/normalize-doc-attributes
normalize_doc_attributes option: convert doc attributes to comments
2018-09-19 11:05:27 +12:00
Ivan Molodetskikh
838df8dfb6
Use correct heuristic for match block flattening 2018-09-11 08:54:43 +03:00
lqd
4b7130dfa1 normalize_doc_attributes option: convert doc attributes to comments
Convert `#![doc]` and `#[doc]` attributes to `//!` and `///` doc comments.
2018-09-07 21:58:35 +02:00
Ryan Leckey
eec74360dc Accept 2015 and 2018 instead of Edition2015 and Edition2018 for edition option 2018-08-31 00:04:23 -07:00
Aaron Loucks
e7932fa9c2 Updating newline_style documentation 2018-07-29 17:02:32 -04:00
Aaron Loucks
6ff2a5e0f3 Auto-detect newline style by default 2018-07-29 10:12:31 -04:00
Nick Cameron
90c5792565 Set rustfmt-format_macro_matchers to false by default
cc #2543
2018-07-18 12:09:50 +12:00
Nick Cameron
79c5ee8b42 Add config options for formatting macro matchers and bodies
Closes #2753
2018-07-18 12:03:59 +12:00
Michael Bebenita
c2ae39e77a Add max_width option for all heuristics.
This is useful when working with very small max_widths like 79 chars.
2018-07-17 13:17:36 -04:00
Nick Cameron
d911b640d1
Merge pull request #2823 from fwalch/default-newline-style
Change default newline style to "Native"
2018-07-17 11:18:10 +12:00
Nick Cameron
ca57ff5b76 Fix Configurations.md
Correct default for `imports_indent`

Closes #2839
2018-07-17 10:45:30 +12:00
Seiichi Uchida
ae2c6a6692 Add a configuration guide for edition 2018-07-09 23:20:38 +09:00
Hannes Karppila
3562e643cf
Add missing equals sign to example configuration 2018-07-07 00:38:32 +03:00
Florian Walch
9d8f3812cc Change default newline style to "Native"
Fixes #2626.
2018-07-02 23:16:17 +02:00
Bernardo Meurer
3681199020
Fixed typo Yess -> Yes 2018-06-27 18:27:20 -07:00
YOSHIOKA Takuma
9212ae7d02
Remove wrong "(default)"
`blank_lines_upper_bound` has default value `1`, not `2`.
2018-06-21 11:42:09 +09:00
Nick Cameron
261238ea51 Change use_small_heuristics to an enum and stabilise
Since it is now an enum, we can be future compatible since we can add variants
for different heuristics.

Closes #1974
2018-06-19 13:28:27 +12:00
Nick Cameron
95d6b64829 Replace WriteMode with EmitMode and backup bool 2018-05-21 14:14:09 +12:00
Nick Cameron
2ee8b0e4c5 Remove remove_blank_lines_at_start_or_end_of_block
cc #1974
2018-05-18 16:56:55 +12:00
Nick Cameron
dd9c15ad01 Unstabilise unstable_features
cc #1974
2018-05-18 16:53:08 +12:00
Nick Cameron
a70f71610c stabilise remove_nested_parens and set default to true 2018-05-18 16:46:22 +12:00
Nick Cameron
d726492e65 Remove spaces_within_parens_and_brackets
cc #1974
2018-05-18 16:35:09 +12:00
Nick Cameron
51f566062f Update uses of rustfmt_skip to rustfmt::skip 2018-05-14 16:25:10 +12:00
topecongiro
84e5634a1b Update tests 2018-05-06 15:14:47 +09:00
csmoe
5b121582e5 add config test 2018-05-06 09:23:45 +08:00
csmoe
7c246344f8 remove nested parens option 2018-05-05 23:13:49 +08:00
csmoe
f7415bcea2 update self format 2018-04-29 20:53:31 +08:00
Mateusz Mikuła
d46b231ccb Fix example for reorder_imports (#2628)
Default value changed in #2605
2018-04-17 23:04:15 +09:00
Nick Cameron
55dd8f1df0
Merge pull request #2603 from topecongiro/merge-nested-imports
Merge imports
2018-04-12 16:40:06 +12:00
Nick Cameron
305c640553 Review changes 2018-04-11 10:50:19 +12:00
Nick Cameron
911395a451 Squash the various 'reorder imports' option into one
cc #2185
2018-04-11 10:46:49 +12:00
Seiichi Uchida
5dd203eabe Add merge_imports config option 2018-04-10 12:36:57 +09:00
Nick Cameron
f14671131e Make error_on_line_overflow false by default
And improve docs, the error message, etc.

I think false is the better default since such errors should only occur due to a bug in Rustfmt and therefore most users should not be notified of it happening (although to be clear, it might be a 'bug' which only occurs with pathological input and therefore we won't fix it). The error has proven to be confusing and annoying in the past.

Closes #1080
2018-04-09 16:47:55 +12:00
Nick Cameron
a3fba04141
Merge pull request #2593 from topecongiro/issue-2455
Add reorder_impl_items config option
2018-04-06 11:12:11 +12:00
Seiichi Uchida
94f5a05a6a Add reorder_impl_items config option 2018-04-05 12:49:16 +09:00
Remi Rampin
37ee9c20aa Improve where_single_line help 2018-03-31 18:51:41 -04:00
Nick Cameron
8dd08ddd92
Merge pull request #2562 from topecongiro/issue-2196
Combine simple heuristics for function calls and array
2018-03-28 16:49:25 +02:00
Michael Noronha
faa9339e5d
/s/featuers/features 2018-03-26 22:40:39 -05:00
Seiichi Uchida
48424ea765 Update tests and cargo fmt 2018-03-26 07:38:39 +09:00
Nick Cameron
bf9f175336 reviewer comments and rebase fallout 2018-03-20 09:27:31 +13:00
Nick Cameron
50c95a074a cargo fmt 2018-03-20 09:27:31 +13:00
topecongiro
3999d64f12 Simplify IgnoreList 2018-03-12 08:41:19 +09:00
Seiichi Uchida
84ad70c151 Add ignore config option
For example, with the following config file, rustfmt will ignore `src/types.rs`,
`src/foo/bar.rs` and every file under `examples/` directory.

```toml
[ignore]
files = [
    "src/types.rs",
    "src/foo/bar.rs",
]
directories = [
    "examples",
]
```
2018-03-09 13:37:52 +09:00
David Lukes
53347bc226 Add license_template_path configuration snippet 2018-03-05 13:19:46 +01:00
topecongiro
34f6408ea2 Update Configurations.md 2018-02-23 21:55:16 +09:00
David Alber
7739cf8f46 Modifying reorder_extern_crates example to show effect on groups 2018-02-19 22:32:44 -08:00
David Alber
00cab7e74c Fixing the documentation for reorder_extern_crates_in_group 2018-02-19 22:32:44 -08:00
David Alber
73b13e0abe Using shorter example for struct_lit_single_line option 2018-02-18 23:17:36 -08:00
David Alber
f2bed291ba Fixing command-line option name 2018-02-12 21:48:57 -08:00
David Alber
429dad72b6 Formatting snippets without configuration option marked as skip 2018-02-12 08:17:43 -08:00
David Alber
d4a518dc0a Fixing control flow examples 2018-02-11 14:48:45 -08:00
Nick Cameron
b7f01769f9
Merge branch 'master' into init-shorthand 2018-02-01 15:20:01 +13:00
Seiichi Uchida
c9c346a89f Add 'use_field_init_shorthand' config option 2018-01-29 22:15:20 +09:00
David Alber
476ec77fa3 Wrapping match_arm_blocks=false snippet in function 2018-01-25 21:05:19 -08:00
David Alber
42efa7cc2f Wrapping match_arm_blocks=true snippet in function 2018-01-25 21:05:19 -08:00
David Alber
d27393528c Fixing use_try_shorthand=true snippet 2018-01-25 21:05:19 -08:00
David Alber
90c3ea716a Fixing use_try_shorthand=false snippet 2018-01-25 21:05:19 -08:00
David Alber
4315e3d968 Fixing type_punctuation_density=Compressed snippet 2018-01-25 21:05:19 -08:00
David Alber
dab8f4991d Fixing type_punctuation_density=Wide snippet 2018-01-25 21:05:19 -08:00
David Alber
61630bc6f5 Wrapping trailing_comma=Never snippet in function 2018-01-25 21:05:19 -08:00
David Alber
6c92808060 Wrapping trailing_comma=Always snippet in function 2018-01-25 21:05:19 -08:00
David Alber
99ae6b8d1f Wrapping trailing_comma=Vertical snippet in function 2018-01-25 21:05:19 -08:00
David Alber
9d696a94e6 Fixing tab_spaces=2 snippet 2018-01-25 21:05:19 -08:00
David Alber
e5cdf0e9fd Fixing tab_spaces=4 snippet 2018-01-25 21:05:19 -08:00
David Alber
fdd126a36e Wrapping struct_lit_single_line=false snippet in function 2018-01-25 21:05:19 -08:00
David Alber
33b5c3f9d5 Fixing spaces_within_parens_and_brackets=true snippet 2018-01-25 21:05:19 -08:00
David Alber
9a9bb8564b Fixing spaces_within_parens_and_brackets=false snippet 2018-01-25 21:05:19 -08:00
David Alber
8d0497bf83 Fixing force_multiline_blocks=true snippet 2018-01-25 21:02:18 -08:00
David Alber
f624f6b5a6 Fixing force_multiline_blocks=false snippet 2018-01-25 21:02:18 -08:00
Seiichi Uchida
a19e1c0b83
Merge pull request #2369 from davidalber/fix-configuration-snippets
Fixing straightforward configuration snippets (Part 1)
2018-01-26 12:35:04 +09:00
David Alber
69f27673df Extending spaces_around_ranges to ranges in match arm patterns 2018-01-21 16:50:17 -08:00
David Alber
2afd1eada3 Wrapping match_block_trailing_comma=true snippet in function 2018-01-16 08:12:32 -08:00
David Alber
44d2fcc2a0 Wrapping match_block_trailing_comma=false snippet in function 2018-01-16 08:12:32 -08:00
David Alber
ee9bdeed7d Fixing imports_layout="HorizontalVertical" snippet 2018-01-16 08:12:32 -08:00
David Alber
e49314fccc Fixing imports_layout="Mixed" snippet 2018-01-16 08:12:32 -08:00
David Alber
c92a3b4066 Fixing imports_indent="Block" snippet 2018-01-16 08:12:32 -08:00
David Alber
167ed92a24 Fixing imports_indent="Visual" snippet 2018-01-16 08:12:32 -08:00
David Alber
df9cbb92bd Fixing format_strings=true snippet 2018-01-16 08:12:31 -08:00
David Alber
30f89c3063 Fixing format_strings=false snippet 2018-01-16 08:12:31 -08:00
David Alber
ed90b2232f Fixing where_single_line=true snippet 2018-01-16 08:12:31 -08:00
David Alber
76947a68d3 Fixing where_single_line=false snippet 2018-01-16 08:12:31 -08:00
David Alber
45deeee80f Fixing brace_style="PreferSameLine" structs and enums snippet 2018-01-16 08:12:31 -08:00
David Alber
034bd7a88e Fixing brace_style="AlwaysNextLine" structs and enums snippet 2018-01-16 08:12:31 -08:00
David Alber
4db479f637 Fixing brace_style="SameLineWhere" structs and enums snippet 2018-01-16 08:12:31 -08:00
David Alber
514adeb156 Getting fn_args_density="Vertical" snippet to pass 2018-01-16 08:12:31 -08:00
David Alber
7e7370756c Wrapping control_brace_style="ClosingNextLine" snippet in function 2018-01-16 08:12:31 -08:00
David Alber
ba7f3ab718 Wrapping control_brace_style="AlwaysNextLine" snippet in function 2018-01-16 08:12:31 -08:00
David Alber
d49e22a2b8 Wrapping control_brace_style="AlwaysSameLine" snippet in function 2018-01-16 08:12:31 -08:00
David Alber
368a44b564 Wrapping condense_wildcard_suffixes=true snippet in function 2018-01-16 08:12:31 -08:00
David Alber
c08c706f55 Wrapping condense_wildcard_suffixes=false snippet in function 2018-01-16 08:12:31 -08:00
David Alber
8b010c30fc Getting binop_separator="Front" snippet to pass 2018-01-16 08:12:31 -08:00
David Alber
b23204fc54 Correcting use_small_heuristics=true snippet 2018-01-16 08:12:31 -08:00
David Alber
3a7eb68db9 Correcting indent_style="Block" where predicate snippet 2018-01-16 08:12:31 -08:00
David Alber
e2ffee7cf8 Wrapping indent_style="Visual" struct snippet in function 2018-01-16 08:12:31 -08:00
David Alber
c6a18143a8 Wrapping indent_style="Block" struct snippet in function 2018-01-16 08:12:31 -08:00