]> git.lizzy.rs Git - rust.git/blob - CHANGELOG.md
d42f38bcef0f5828007421279028c96ad67be315
[rust.git] / CHANGELOG.md
1 # Changelog
2
3 ## [Unreleased]
4
5 - Change option `format_doc_comment` to `format_code_in_doc_comment`.
6 - `use_small_heuristics` changed to be an enum and stabilised. Configuration
7   options are now ready for 1.0.
8
9 ## [1.2.0] 2019-03-27
10
11 ### Added
12
13 - Add new attribute `rustfmt::skip::macros` to prevent rustfmt from formatting a macro #3454
14
15 ### Changed
16
17 - Discard error report in silent_emitter #3466
18
19 ### Fixed
20
21 - Fix bad performance on deeply nested binary expressions #3467
22 - Use BTreeMap to guarantee consistent ordering b4d4b57
23
24 ## [1.1.1] 2019-03-21
25
26 ### Fixed
27
28 - Avoid panic on macro inside deeply nested block c9479de
29 - Fix line numbering in missed spans and handle file_lines in edge cases cdd08da
30 - Fix formatting of async blocks 1fa06ec
31 - Avoid duplication on the presence of spaces between macro name and `!` #3464
32
33 ## [1.1.0] 2019-03-17
34
35 ### Added
36
37 - Add `inline_attribute_width` configuration option to write an item and its attribute on the same line if their combined width is below a threshold #3409
38 - Support `const` generics f0c861b
39 - Support path clarity module #3448
40
41 ### Changed
42
43 - Align loop and while formatting 7d9a2ef
44 - Support `EmitMode::ModifiedLines` with stdin input #3424
45 - Update `rustc-ap-*` crates to 407.0.0
46 - Remove trailing whitespaces in missing spans 2d5bc69
47
48 ### Fixed
49
50 - Do not remove comment in the case of no arg 8e3ef3e
51 - Fix `Ident of macro+ident gets duplicated` error 40ff078
52 - Format the if expression at the end of the block in a single line 5f3dfe6
53
54 ## [1.0.3] 2019-02-14
55
56 ### Added
57
58 - Point unstable options to tracking issues 412dcc7
59
60 ### Changed
61
62 - Update `rustc-ap-*` crates to 373.0.0
63
64 ## [1.0.2] 2019-02-12
65
66 ### Added
67
68 - Add a [section](https://github.com/rust-lang/rustfmt/blob/ae331be/Contributing.md#version-gate-formatting-changes) to the Contributing.md file about version-gating formatting changes 36e2cb0
69 - Allow specifying package with `-p` CLI option a8d2591
70 - Support `rustfmt::skip` on imports #3289
71 - Support global `rustfmt.toml` to be written in user config directory #3280
72 - Format visibility on trait alias 96a3df3
73
74 ### Changed
75
76 - Do not modify original source code inside macro call #3260
77 - Recognize strings inside comments in order to avoid indenting them baa62c6
78 - Use Unicode-standard char width to wrap comments or strings a01990c
79 - Change new line point in the case of no args #3294
80 - Use the same formatting rule between functions and macros #3298
81 - Update rustc-ap-rustc_target to 366.0.0, rustc-ap-syntax to 366.0.0, and rustc-ap-syntax_pos to 366.0.0
82
83 ### Fixed
84
85 - rewrite_comment: fix block fallback when failing to rewrite an itemized block ab7f4e1
86 - Catch possible tokenizer panics #3240
87 - Fix macro indentation on Windows #3266
88 - Fix shape when formatting return or break expr on statement position #3259
89 - rewrite_comment: fix block fallback when failing to rewrite an itemized block
90 - Keep leading double-colon to respect the 2018 edition of rust's paths a2bfc02
91 - Fix glob and nested global imports 2125ad2
92 - Do not force trailing comma when using mixed layout #3306
93 - Prioritize `single_line_fn` and `empty_item_single_line` over `brace_style` #3308
94 - Fix `internal error: left behind trailing whitespace` with long lines c2534f5
95 - Fix attribute duplication #3325
96 - Fix formatting of strings within a macro 813aa79
97 - Handle a macro argument with a single keyword 9a7ea6a
98
99 ## [1.0.1] 2018-12-09
100
101 ### Added
102
103 - Add a `version` option 378994b
104
105 ### Changed
106
107 - End expressions like return/continue/break with a semicolon #3223
108 - Update rustc-ap-rustc_target to 306.0.0, rustc-ap-syntax to 306.0.0, and rustc-ap-syntax_pos to 306.0.0
109
110 ### Fixed
111
112 - Allow to run a rustfmt command from cargo-fmt even when there is no target a2da636
113 - Fix `un-closed delimiter` errors when formatting break labels 40174e9
114
115 ## [1.0.0] 2018-11-19
116
117 ### Changed
118
119 - Preserve possibly one whitespace for brace macros 1a3bc79
120 - Prefer to break arguments over putting output type on the next line 1dd54e6
121
122 ## [0.99.9] 2018-11-15
123
124 ### Changed
125
126 - Update rustc-ap-rustc_target to 297.0.0, rustc-ap-syntax to 297.0.0, to rustc-ap-syntax_pos to 297.0.0
127 - Don't align comments on `extern crate`s dd7add7
128
129 ## [0.99.8] 2018-11-14
130
131 ### Added
132
133 - Add `overflow_delimited_expr` config option to more aggressively allow overflow #3175
134
135 ### Fixed
136
137 - Fix the logic for retaining a comment before the arrow in a match #3181
138 - Do not wrap comments in doctest to avoid failing doctest runs #3183
139 - Fix comment rewriting that was wrapping code into a line comment #3188
140 - Fix formatting of unit-struct with `where`-clause #3200
141
142 ## [0.99.7] 2018-11-07
143
144 ### Changed
145
146 - Force a newline after the `if` condition if there is a different indentation level #3109
147 - Use correct width when formatting type on local statement #3126
148 - Treat crates non-alphabetically when ordering 799005f
149 - Fix formatting of code that is annotated with rustfmt::skip #3113
150 - Stabilize `edition` configuration option 9c3ae2d
151 - cargo-fmt: detect Rust edition in use #3129
152 - Trim the indentation on macros which heuristically appear to use block-style indentation #3178
153
154 ### Fixed
155
156 - Do not remove path disambiugator inside macro #3142
157 - Improve handling of Windows newlines #3141
158 - Fix alignment of a struct's fields (`struct_field_align_threshold` option) with the Visual `indent_style` #3165
159 - Fix a bug in formatting markdown lists within comments #3172
160
161 ## [0.99.6] 2018-10-18
162
163 ### Added
164
165 - Add `enum_discrim_align_threshold` option to vertically align enum discriminants cc22869
166 - Add `println!`-like heuristic to the `fail` attribute #3067
167 - Handle itemized items inside comments #3083
168 - Add `format_doc_comments` configuration option to control the formatting of code snippets inside comments #3089
169
170 ### Changed
171
172 - Makes brace behavior consistent with empty bodies for traits and impls 2727d41
173 - Consider a multi-lined array as a block-like expression #3969
174 - Improve formatting of strings #3073
175 - Get rid of extra commas in Visual struct literal formatting #3077
176 - Update rustc-ap-rustc_target to 274.0.0, rustc-ap-syntax to 274.0.0, and rustc-ap-syntax_pos to 274.0.0
177 - Format macro calls with item-like arguments #3080
178 - Avoid control flow expressions conditions to go multi line ef59b34
179 - Simplify multi-lining binop expressions #3101
180
181 ### Fixed
182
183 - Do not format a code block in documentation if it is annotated with ignore or text 2bcc3a9
184 - Fix inconsistent overflow behavior in Visual style #3078
185 - Fix corner cases of the string formatting implementation #3083
186 - Do not add parens around lifetimes 0ac68c9
187 - Catch parser panic in format_snippet 8c4e92a
188
189 ## [0.99.5] 2018-09-25
190
191 ### Added
192
193 - Handle leading module separator for 2018 Edition #2952
194 - Add configuration option `normalize_doc_attributes`: convert doc attributes to comments #3002
195
196 ### Changed
197
198 - Accept 2015 and 2018 instead of Edition2015 and Edition2018 for edition option eec7436
199 - Support platforms without a timer 46e2a2e
200 - Update rustc-ap-rustc_target to 263.0.0, rustc-ap-syntax to 263.0.0, and rustc-ap-syntax_pos to 263.0.0
201
202 ### Fixed
203
204 - Format of attributes with commas #2971
205 - Fix optional arg condensing #2972
206 - Improve formatting of long function parameters #2981
207 - Fix formatting of raw string literals #2983
208 - Handle chain with try operators with spaces #2986
209 - Use correct shape in Visual tuple rewriting #2987
210 - Impove formatting of arguments with `visual_style = "Visual"` option #2988
211 - Change `print_diff` to output the correct line number 992b179
212 - Propagate errors about failing to rewrite a macro 6f318e3
213 - Handle formatting of long function signature #3010
214 - Fix indent computation of a macro with braces c3edf6d
215 - Format generics on associated types #3035
216 - Incorrect indentation of multiline block match expression #3042
217 - Fix bug in import where two consecutive module separators were possible 98a0ef2
218 - Prevent right-shifting of block comments with bare lines 5fdb6db
219
220 ## [0.99.4] 2018-08-27
221
222 ### Added
223
224 - Handle formatting of underscore imports #2951
225 - Handle formatting of try blocks #2965
226
227 ### Changed
228
229 - Update rustc-ap-rustc_target to 237.0.0, rustc-ap-syntax to 237.0.0, and rustc-ap-syntax_pos to 237.0.0 ca19c9a
230 - Consider `dev` channel as nightly for unstable features #2948
231
232 ### Fixed
233
234 - Fix formatting of patterns with ellipsis # 2942
235
236 ## [0.99.3] 2018-08-23
237
238 ### Added
239
240 - Use path attribute when searching for modules #2901
241 - Expose FileLines JSON representation to allow external libraries to use the file_lines option #2915
242
243 ### Changed
244
245 - Replace '--conifig-help' with '--config=help' cb10e06
246 - Improve formatting of slice patterns #2912
247
248 ### Fixed
249
250 - Format chains with comment #2899
251 - Fix indentation of formatted macro body #2920
252 - Fix indentation of block comments f23e6aa
253
254 ## [0.99.2] 2018-08-07
255
256 ### Changed
257
258 - Update rustc-ap-rustc_target to 218.0.0, rustc-ap-syntax to 218.0.0, and rustc-ap-syntax_pos to 218.0.0 5c9a2b6
259 - Combine function-like attributes #2900
260
261 ### Fixed
262
263 - Explicitly handle semicolon after the item in statement position d96e3ca
264 - Fix parsing '#'-hiding of rustdoc 2eca09e
265
266 ## [0.99.1] 2018-08-04
267
268 ### Fixed
269
270 - fix use statements ordering when a number is present 1928ae7
271
272 ## [0.99.0] 2018-08-03
273
274 - 1.0 RC release
275
276 ### Changed
277
278 - Clarification in README.md 30fe66b
279
280 ## [0.9.0] 2018-08-01
281
282 ### Added
283
284 - Handle raw identifiers 3027c21
285 - Format async closure 60ce411
286 - Add max_width option for all heuristics c2ae39e
287 - Add config option `format_macro_matchers` to format the metavariable matching patterns in macros 79c5ee8
288 - Add config option `format_macro_bodies` to format the bodies of macros 79c5ee8
289 - Format exitential type fc307ff
290 - Support raw identifiers in struct expressions f121b1a
291 - Format Async block and async function 0b25f60
292
293 ### Changed
294
295 - Update rustc-ap-rustc_target to 211.0.0, rustc-ap-syntax to 211.0.0, and rustc-ap-syntax_pos to 211.0.0
296 - Put each nested import on its own line while putting non-nested imports on the same line as much as possible 42ab258
297 - Respect `empty_item_single_line` config option when formatting empty impls. Put the `where` on its own line to improve readability #2771
298 - Strip leading `|` in match arm patterns 1d4b988
299 - Apply short function call heuristic to attributes 3abebf9
300 - Indent a match guard if the pattern is multiline be4d37d
301 - Change default newline style to `Native` 9d8f381
302 - Improve formatting of series of binop expressions a4cdb68
303 - Trigger an internal error if we skip formatting due to a lost comment b085113
304 - Refactor chain formatting #2838
305
306 ### Fixed
307
308 - Do not insert spaces around braces with empty body or multiple lines 2f65852
309 - Allow using mixed layout with comments #2766
310 - Handle break labels #2726
311 - fix rewrite_string when a line feed is present 472a2ed
312 - Fix an anomaly with comments and array literals b28a0cd
313 - Check for comments after the `=>` in a match arm 6899471
314
315 ## [0.8.0,0.8.1,0.8.2] 2018-05-28
316
317 ### Added
318
319 - Use scoped attributes for skip attribute https://github.com/rust-lang/rustfmt/pull/2703
320
321 ### Changed
322
323 - Comment options `wrap_comments` and `normalize_comments` are reverted back to unstable 416bc4c
324 - Stabilise `reorder_imports` and `reorder_modules` options 7b6d2b4
325 - Remove `spaces_within_parens_and_brackets` option d726492
326 - Stabilise shorthand options: `use_try_shorthand`, `use_field_init_shorthand`, and `force_explicit_abi` 8afe367
327 - Stabilise `remove_nested_parens` and set default to true a70f716
328 - Unstabilise `unstable_features` dd9c15a
329 - Remove `remove_blank_lines_at_start_or_end_of_block` option 2ee8b0e
330 - Update rustc-ap-syntax to 146.0.0 and rustc-ap-rustc_target to 146.0.0 2c275a2
331 - Audit the public API #2639
332
333 ### Fixed
334
335 - Handle code block in doc comment without rust prefix f1974e2
336
337 ## [0.7.0] 2018-05-14
338
339 ### Added
340
341 - Add integration tests against crates in the rust-lang-nursery c79f39a
342
343 ### Changed
344
345 - Update rustc-ap-syntax to 128.0.0 and ustc-ap-rustc_target to 128.0.0 195395f
346 - Put operands on its own line when each fits in a single line f8439ce
347 - Improve CLI options 55ac062 1869888 798bffb 4d9de48 eca7796 8396da1 5d9f5aa
348
349 ### Fixed
350
351 - Use correct line width for list attribute 61a401a
352 - Avoid flip-flopping impl items when reordering them 37c216c
353 - Formatting breaks short lines when max_width is less than 100 9b36156
354 - Fix variant "Mixed" of imports_layout option 8c8676c
355 - Improve handling of long lines f885039
356 - Fix up lines exceeding max width 51c07f4
357 - Fix handling of modules in non_modrs_mods style cf573e8
358 - Do not duplicate attributes on use items e59ceaf
359 - Do not insert an extra brace in macros with native newlines 4c9ef93
360
361 ## [0.6.1] 2018-05-01
362
363 ### Changed
364
365 - Change the default value of imports_indent to IndentStyle::Block https://github.com/rust-lang/rustfmt/pull/2662
366
367 ### Fixed
368
369 - Handle formatting of auto traits 5b5a72c
370 - Use consistent formatting for empty enum and struct https://github.com/rust-lang/rustfmt/pull/2656
371
372 ## [0.6.0] 2018-04-20
373
374 ### Changed
375
376 - Improve public API 8669004
377
378 ## [0.5.0] 2018-04-20
379
380 ### Added
381
382 - Add `verbose-diff` CLI option 5194984
383
384 ### Changed
385
386 - Update rustc-ap-syntax to 103.0.0 dd807e2
387 - Refactor to make a sensible public API ca610d3
388
389 ### Fixed
390
391 - Add spaces between consecutive `..` `..=` 61d29eb
392
393 ## [0.4.2] 2018-04-12
394
395 ### Added
396
397 - Handle binary operators and lifetimes 0fd174d
398 - Add reorder_impl_items config option 94f5a05
399 - Add `--unstable-features` CLI option to list unstable options from the `--help` output 8208f8a
400 - Add merge_imports config option 5dd203e
401
402 ### Changed
403
404 - Format macro arguments with vertical layout ec71459
405 - Reorder imports by default 164cf7d
406 - Do not collapse block around expr with condition on match arm 5b9b7d5
407 - Use vertical layout for complex attributes c77708f
408 - Format array using heuristics for function calls 98c6f7b
409 - Implement stable ordering for impl items with the the following item priority: type, const, macro, then method fa80ddf
410 - Reorder imports by default 164cf7d
411 - Group `extern crate` by default 3a138a2
412 - Make `error_on_line_overflow` false by default f146711
413 - Merge imports with the same prefix into a single nested import 1954513
414 - Squash the various 'reorder imports' option into one 911395a
415
416 ### Fixed
417
418 - Print version is missing the channel ca6fc67
419 - Do not add the beginning vert to the match arm 1e1d9d4
420 - Follow indent style config when formatting attributes efd295a
421 - Do not insert newline when item is empty a8022f3
422 - Do not indent or unindent inside string literal ec1907b
423
424 ## [0.4.1] 2018-03-16
425
426 ### Added
427
428 - Add `ignore` configuration option.
429 - Add `license_template_path` configuration option.
430 - Format `lazy_static!`.
431
432 ### Fixed
433
434 - Fix formatting bugs.
435 - Fix setting `reorder_modules` removing inline modules.
436 - Format attributes on block expressions.
437 - Support `dyn trait` syntax.
438 - Support multiple patterns in `if let` and `while let`.
439 - Support a pattern with parentheses.
440
441 ## [0.4.0] 2018-03-02
442
443 ### Changed
444
445 - Do not print verbose outputs when formatting with stdin.
446 - Preserve trailing whitespaces in doc comments.
447 - Scale the values of width heuristics by `max_width`.
448
449 ### Fixed
450
451 - Do not reorder items with `#[macro_use]`.
452 - Fix formatting bugs.
453 - Support the beginning `|` on a match arm.
454
455 ## [0.3.8] 2018-02-04
456
457 ### Added
458
459 - Format (or at least try to format) `macro_rules!`.
460
461 ## [0.3.7] 2018-02-01
462
463 ### Added
464
465 - Add `use_field_init_shorthand` config option.
466 - Add `reorder_modules` configuration option.
467
468 ## [0.3.6] 2018-01-18
469
470 ### Fixed
471
472 - Fix panicking on formatting certain macros (#2371).
473
474 ## [0.3.5] 2018-01-15
475
476 ### Changed
477
478 - Format code block in comments when `wrap_comments` is set to `true`.
479 - Remove `same_line_attributes` configuration option.
480 - Rename `git-fmt` to `git-rustfmt`.
481
482 ### Fixed
483
484 - Rustup to `rustc 1.25.0-nightly (e6072a7b3 2018-01-13)`.
485 - Fix formatting bugs.
486
487 ## [0.3.4] 2017-12-23
488
489 ### Added
490
491 - Add `--version` flag to `cargo-fmt`, allow `cargo fmt --version`.
492
493 ### Fixed
494
495 - Rustup to `rustc 1.24.0-nightly (5165ee9e2 2017-12-22)`.
496
497 ## [0.3.3] 2017-12-22
498
499 ### Added
500
501 - Format trait aliases.
502
503 ### Changed
504
505 - `cargo fmt` will format every workspace member.
506
507 ### Fixed
508
509 - Rustup to `rustc 1.24.0-nightly (250b49205 2017-12-21)`
510 - Fix formatting bugs.
511
512 ## [0.3.2] 2017-12-15
513
514 ### Changed
515
516 - Warn when unknown configuration option is used.
517
518 ### Fixed
519
520 - Rustup to `rustc 1.24.0-nightly (0077d128d 2017-12-14)`.
521
522 ## [0.3.1] 2017-12-11
523
524 ### Added
525
526 - Add `error_on_unformatted` configuration option.
527 - Add `--error-on-unformatted` command line option.
528
529 ### Changed
530
531 - Do not report formatting errors on comments or strings by default.
532 - Rename `error_on_line_overflow_comments` to `error_on_unformatted`.
533
534 ### Fixed
535
536 - Fix formatting bugs.
537 - Fix adding a trailing whitespace inside code block when `wrap_comments = true`.
538
539 ## [0.3.0] 2017-12-11
540
541 ### Added
542
543 - Support nested imports.
544
545 ### Changed
546
547 - Do not report errors on skipped items.
548 - Do not format code block inside comments when `wrap_comments = true`.
549 - Keep vertical spaces between items within range.
550 - Format `format!` and its variants using compressed style.
551 - Format `write!` and its variants using compressed style.
552 - Format **simple** array using compressed style.
553
554 ### Fixed
555
556 - Fix `rustfmt --package package_name` not working properly.
557 - Fix formatting bugs.
558
559 ## [0.2.17] 2017-12-03
560
561 ### Added
562
563 - Add `blank_lines_lower_bound` and `blank_lines_upper_bound` configuration options.
564
565 ### Changed
566
567 - Combine configuration options related to width heuristic into `width_heuristic`.
568 - If the match arm's body is `if` expression, force to use block.
569
570 ### Fixed
571
572 - Fix `cargo fmt --all` being trapped in an infinite loop.
573 - Fix many formatting bugs.
574
575 ### Removed
576
577 - Remove legacy configuration options.
578
579 ## [0.2.16] 2017-11-21
580
581 ### Added
582
583 - Remove empty lines at the beginning of the file.
584 - Soft wrapping on doc comments.
585
586 ### Changed
587
588 - Break before `|` when using multiple lines for match arm patterns.
589 - Combine `control_style`, `where_style` and `*_indent` config options into `indent_style`.
590 - Combine `item_brace_style` and `fn_brace_style` config options into `brace_style`.
591 - Combine config options related spacing around colons into `space_before_colon` and `space_after_colon`.
592
593 ### Fixed
594
595 - Fix many bugs.
596
597 ## [0.2.15] 2017-11-08
598
599 ### Added
600
601 - Add git-fmt tool
602 - `where_single_line` configuration option.
603
604 ### Changed
605
606 - Rename `chain_one_line_max` to `chain_width`.
607 - Change the suffix of indent-related configuration options to `_indent`.
608
609 ## [0.2.14] 2017-11-06
610
611 ### Fixed
612
613 - Rustup to the latest nightly.
614
615 ## [0.2.13] 2017-10-30
616
617 ### Fixed
618
619 - Rustup to the latest nightly.
620
621 ## [0.2.12] 2017-10-29
622
623 ### Fixed
624
625 - Fix a bug that `cargo fmt` hangs forever.
626
627 ## [0.2.11] 2017-10-29
628
629 ### Fixed
630
631 - Fix a bug that `cargo fmt` crashes.
632
633 ## [0.2.10] 2017-10-28
634
635 ## [0.2.9] 2017-10-16
636
637 ## [0.2.8] 2017-09-28
638
639 ## [0.2.7] 2017-09-21
640
641 ### Added
642
643 - `binop_separator` configuration option (#1964).
644
645 ### Changed
646
647 - Use horizontal layout for function call with a single argument.
648
649 ### Fixed
650
651 - Fix panicking when calling `cargo fmt --all` (#1963).
652 - Refactorings & faster rustfmt.
653
654 ## [0.2.6] 2017-09-14
655
656 ### Fixed
657
658 - Fix a performance issue with nested block (#1940).
659 - Refactorings & faster rustfmt.
660
661 ## [0.2.5] 2017-08-31
662
663 ### Added
664
665 - Format and preserve attributes on statements (#1933).
666
667 ### Fixed
668
669 - Use getters to access `Span` fields (#1899).
670
671 ## [0.2.4] 2017-08-30
672
673 ### Added
674
675 - Add support for `Yield` (#1928).
676
677 ## [0.2.3] 2017-08-30
678
679 ### Added
680
681 - `multiline_closure_forces_block` configuration option (#1898).
682 - `multiline_match_arm_forces_block` configuration option (#1898).
683 - `merge_derives` configuration option (#1910).
684 - `struct_remove_empty_braces` configuration option (#1930).
685 - Various refactorings.
686
687 ### Changed
688
689 - Put single-lined block comments on the same line with list-like structure's item (#1923).
690 - Preserve blank line between doc comment and attribute (#1925).
691 - Put the opening and the closing braces of enum and struct on the same line, even when `item_brace_style = "AlwaysNextLine"` (#1930).
692
693 ### Fixed
694
695 - Format attributes on `ast::ForeignItem` and take max width into account (#1916).
696 - Ignore empty lines when calculating the shortest indent width inside macro with braces (#1918).
697 - Handle tabs properly inside macro with braces (#1918).
698 - Fix a typo in `compute_budgets_for_args()` (#1924).
699 - Recover comment between keyword (`impl` and `trait`) and `{` which used to get removed (#1925).