Eric
33d1368674
test: add test for #4257
2021-09-02 20:53:15 -05:00
Eric
d19f69cd71
test: add missing source for #4943
2021-09-02 20:53:15 -05:00
Yusuke Tanaka
ca9b050bbf
Implement One
option for imports_granularity ( #4669 )
...
This option merges all imports into a single `use` statement as long as
they have the same visibility.
2021-08-31 18:33:06 -05:00
Cameron Steffen
a603756cc5
Temporary fix rustfmt for let-else
2021-08-30 20:18:41 -05:00
Deadbeef
20ddab3def
Fix rustfmt test
2021-08-27 11:53:03 +00:00
Deadbeef
076916fe94
Introduce ~const
...
- [x] Removed `?const` and change uses of `?const`
- [x] Added `~const` to the AST. It is gated behind const_trait_impl.
- [x] Validate `~const` in ast_validation.
- [ ] Add enum `BoundConstness` to the HIR. (With variants `NotConst` and
`ConstIfConst` allowing future extensions)
- [ ] Adjust trait selection and pre-existing code to use `BoundConstness`.
- [ ] Optional steps (*for this PR, obviously*)
- [ ] Fix #88155
- [ ] Do something with constness bounds in chalk
2021-08-27 05:07:37 +00:00
Ashvin Arsakularatne
e81c393663
fix: remove wrong reformatting of qualified paths in struct patterns
2021-08-25 21:18:41 -05:00
David Tolnay
fd6b025e8a
Preserve visibility on trait items inside trait and impl
2021-08-22 12:06:18 -05:00
David Tolnay
c8bd550c8d
Add test for visibility on a trait item (currently wrong)
2021-08-22 12:06:18 -05:00
Frank Steffahn
9bc0dbeb64
Fix typos “an”→“a” and a few different ones that appeared in the same search
2021-08-22 18:15:49 +02:00
Caleb Cartwright
5d8eb8d79c
fix: don't drop drop generic args on assoc ty constraints
2021-08-08 13:58:10 -05:00
Caleb Cartwright
fefb5427a2
fix: handle GAT types in impls with self bounds
2021-08-06 22:03:40 -05:00
Ellen
0b21ea2161
Unyeet const param defaults
2021-07-27 19:50:11 -05:00
Caleb Cartwright
e4b8714c09
Merge commit '4236289b75ee55c78538c749512cdbeea5e1c332' into update-rustfmt
2021-07-25 22:57:19 -05:00
Caleb Cartwright
b305d62e5b
fix: correct arm leading pipe check ( #4880 )
...
In the event a pattern starts with a leading pipe
the pattern span will contain, and begin with, the pipe.
This updates the process to see if a match arm contains
a leading pipe by leveraging this recent(ish) change to
the patterns in the AST, and avoids an indexing bug that
occurs when a pattern starts with a non-ascii char in the
old implementation.
2021-07-25 22:53:32 -05:00
Caleb Cartwright
2608f2c63b
fix(rustfmt): load nested out-of-line mods correctly
2021-06-17 22:35:19 -05:00
Caleb Cartwright
2a3635d5d1
tests: remove snippets with inner attrs on non-block expressions
2021-05-04 18:38:22 -05:00
ChinYing-Li
84ff0013c2
Add the case in duplicate issue ( #4806 ) to the idempotent tests
2021-04-21 21:30:42 -05:00
ChinYing-Li
dac2423f3f
Recognize when a block comment has been ended inside a string literal ( #4312 )
2021-04-21 21:30:42 -05:00
Joseph Birr-Pixton
58157bb4b7
Add some basic tests for chain_width use
2021-04-21 21:27:50 -05:00
Caleb Cartwright
a168d92f9a
tests: augment heuristics tests
2021-04-21 21:27:50 -05:00
Caleb Cartwright
1bcc1f8df5
refactor: apply heuristic config changes in lib
2021-04-21 21:27:50 -05:00
David Bar-On
432e09e89f
Add the use of rewrite_assign_rhs_with_comments to 1.x
2021-02-17 20:47:20 -06:00
David Bar-On
4b0ed96f2e
Fix for issue 4603 about extra macro body indentation (third version)
2021-02-17 20:19:27 -06:00
Caleb Cartwright
d80a42fdd8
tests: add case for issue 4675
2021-01-28 22:01:50 -06:00
Caleb Cartwright
c13d2452c0
chore: backport some empty block check fixes
2021-01-27 20:58:42 -06:00
vallentin
1e2b0b7c72
Added 4646 test case
2021-01-27 20:58:42 -06:00
Michael Morgan
384ba68d64
Add imports_granularity="Item".
...
This option splits all imports into their own `use` statement.
2021-01-27 20:58:42 -06:00
Sean Klein
5e14f760c5
fix: Avoid incorrect global 'cfg_if' Symbol interning
...
Fixes #4656
2021-01-27 19:26:58 -06:00
Ayaz Hafiz
f8deed3a3a
Include const generic type bounds in their spans
...
Closes #4310
2021-01-27 18:50:03 -06:00
topecongiro
152ccb5059
Do not duplicate const keyword on parameters
2021-01-27 18:50:03 -06:00
Seiichi Uchida
c0fede355c
Use the span after generics and where clause ( #4208 )
2021-01-27 18:50:03 -06:00
hafiz
269584634a
Include constness in impl blocks ( #4215 )
...
Closes #4084
2021-01-27 18:50:03 -06:00
Geoffry Song
71863753bd
Rename merge_imports
to imports_granularity
and add a Module
option.
...
This renames the existing `true`/`false` options to `Crate`/`Never`, then adds a
new `Module` option which causes imports to be grouped together by their
originating module.
2021-01-17 11:48:47 -06:00
Caleb Cartwright
b30cb24286
fix: indentation issue on generic bounds
2021-01-16 11:17:23 -06:00
Caleb Cartwright
3571c5d6f7
fix: maintain redundant semis on items in statement pos
2021-01-09 12:11:52 -06:00
Mara Bos
f0eaaeda9e
Add 2021 test.
2021-01-09 12:11:52 -06:00
Mara Bos
b623eb324c
Fix expected macro formatting test output.
2021-01-09 12:11:52 -06:00
Seiichi Uchida
0d022d08d8
Format error and typeof types ( #4416 )
...
* Add a test for #4357
* Format error and typeof types
2020-12-20 12:05:05 -06:00
Stéphane Campinas
c536d80dc1
Fix rewrite of closures with a return type
...
If the closure's body fits in a line, the block is removed but it is
necessary if the closure has a return type.
2020-12-20 12:05:05 -06:00
Caleb Cartwright
4cfb9ef8f4
fix: don't strip nonexistent comma in derive
2020-12-20 12:05:05 -06:00
David Tolnay
c40a8c1ecc
Add negative impl test
2020-11-30 23:24:36 -06:00
WhizSid
7d9ee7558e
Comment between typebounds ( #4474 )
...
* Test cases and get spans
* Fixed type bounds
* Fixed issue of test cases
* Fixed first test case issue
* Removed unwanted whitespaces
* Removed tmp files
2020-11-29 13:26:58 -06:00
WhizSid
b7c38c9d50
Fixed comment dropped between & and type issue ( #4482 )
...
* Fixed comment dropped between & and type issue
* Reduced nesting levels and avoided duplications
* Removed extra allocations
2020-11-29 13:26:58 -06:00
WhizSid
6455e9de0e
Fixed 'Comment removed between type name and =' issue ( #4448 )
...
* Fixed Comment removed between type name and = issue
* Fixed where clause issue and pass the full span
* has_where condition inline
* Fixed indentation error on where clause
* Removed tmp file
2020-11-29 13:26:58 -06:00
hafiz
5e7fb45533
Pick up comments between visibility modifier and item name ( #4239 )
...
* Pick up comments between visibility modifier and item name
I don't think this hurts to fix. #2781 , which surfaced this issue, has
a number of comments relating to similar but slightly different issues
(i.e. dropped comments in other places). I can mark #2781 as closed and
then will open new issues for the comments that are not already resolved
or tracked.
Closes #2781
* fixup! Pick up comments between visibility modifier and item name
* fixup! Pick up comments between visibility modifier and item name
2020-11-29 13:26:58 -06:00
Caleb Cartwright
fb7e604538
tests: backport an additional test case
2020-11-29 13:26:58 -06:00
Adam H. Leventhal
c7359945a4
tests
2020-11-29 13:26:58 -06:00
hafiz
c77c6a405d
Compare code block line indentation with config whitespace ( #4166 )
...
Previously the indetation of a line was compared with the configured
number of spaces per tab, which could cause lines that were formatted
with hard tabs not to be recognized as indented ("\t".len() < " ".len()).
Closes #4152
2020-11-29 13:26:58 -06:00
David Tolnay
e7ecdc1664
Remove async fn
from extern block tests
2020-11-28 21:59:30 -06:00
Ayaz Hafiz
3bf67c175d
Don't drop blocks on foreign functions
...
A code like
```rust
extern "C" {
fn f() {
fn g() {}
}
}
```
is incorrect and does not compile. Today rustfmt formats this in a way
that is correct:
```rust
extern "C" {
fn f();
}
```
But this loses information, and doesn't have to be done because we know
the content of the block if it is present. During development I don't
think rustfmt should drop the block in this context.
Closes #4313
2020-11-28 21:59:30 -06:00
topecongiro
8e46225547
Add a test
2020-11-28 21:59:30 -06:00
Caleb Cartwright
4d9fa00fd5
feat: support underscore expressions
2020-11-28 17:41:21 -06:00
Caleb Cartwright
4f32ce8434
feat: support struct/slice destructuring
2020-11-28 17:41:21 -06:00
meiomorphism
003786228d
fix: don't force a newline after an empty where clause
...
Fixes #4547 .
2020-11-25 21:32:46 -06:00
Matt
073cc3891f
Option to create groups for std, external crates, and other imports
...
Backport of 17d90ca.
2020-11-18 21:37:42 -06:00
Caleb Cartwright
89f38304a7
fix: don't drop leading comments in extern
2020-11-16 15:48:20 -06:00
Caleb Cartwright
eed826f8a7
tests: attributed comment-only blocks
2020-11-14 11:50:28 -06:00
WhizSid
faf97a67d6
Fixed 'Incorrect comment indent inside if/else' issue. ( #4459 )
...
* Added test cases
* Fixed if condition comment issue
* Fixed extern C issue
* Removed previous test case
* Removed tmp file
* honor the authors intent
* Changed the file name to its original name
* Removed extra whitespace
2020-11-14 11:50:28 -06:00
Ayaz Hafiz
dd32de74ce
fixup! Correctly create artificial span for formatting closure body
2020-11-14 11:50:28 -06:00
Caleb Cartwright
a613c57521
feat: don't insert semi in macro_rules arm body
2020-11-11 18:26:13 -06:00
Aaron Hill
46ab14437e
Don't flatten a block containing a single macro call
...
We no longer flatten a block that looks like this:
```rust
match val {
pat => { macro_call!() }
}
```
Currently, rust ignores trailing semicolons in macro expansion in
expression position (see https://github.com/rust-lang/rust/issues/33953 )
If this is changed, flattening a block with a macro call may break the
user's code - the trailing semicolon will no longer parse if the macro
call occurs immediately on the right-hand side of the match arm
(e.g. `pat => macro_call!()`)
2020-11-05 20:45:11 -06:00
Caleb Cartwright
15854e5fd3
feat: v2 support for nested tuples w/o spaces
2020-11-02 18:31:51 -06:00
Scott McMurray
278e8da33b
Add some basic tests for try{}
expressions
...
They failed to parse in rustfmt on me in https://github.com/rust-lang/rust/pull/77877 , which looks like it's since been fixed, but I figured I'd send in some tests anyway.
2020-11-02 18:31:51 -06:00
Caleb Cartwright
86a41bc80b
tests: add test for panic on new_parser_from_file
2020-11-02 18:31:51 -06:00
Caleb Cartwright
9faba4539b
fix(parser): better unclosed delims handling
2020-11-02 18:31:51 -06:00
hafiz
6a7824787e
Preserve comments in empty statements ( #4180 )
...
* Preserve comments in empty statements
Closes #4018
* fixup! Preserve comments in empty statements
2020-10-24 11:13:00 -05:00
Ayaz Hafiz
e70343a5f5
Correctly indent skipped-over code
...
Closes #4398
2020-10-24 11:13:00 -05:00
Ayaz Hafiz
92ab76cfa7
fixup! Preserve and format type aliases in extern blocks
2020-10-01 19:12:22 -05:00
Ayaz Hafiz
a9b0b057eb
fixup! Preserve and format type aliases in extern blocks
2020-10-01 19:12:22 -05:00
Ayaz Hafiz
a15800a327
Preserve and format type aliases in extern blocks
...
Previously, non-trivial type aliases in extern blocks were dropped by
rustfmt because only the type alias name would be passed to a rewritter.
This commit fixes that by passing all type information (generics,
bounds, and assignments) to a type alias rewritter, and consolidates
`rewrite_type_alias` and `rewrite_associated_type` as one function.
2020-10-01 19:12:22 -05:00
Caleb Cartwright
4908ee19c3
tests: add tests for leading pipe config
2020-09-24 09:43:31 -05:00
David Tolnay
146578c480
Add regression test for unsafe mods
2020-09-23 00:45:18 -05:00
Caleb Cartwright
62dc7c5c6b
fix: inner attribute formatting
2020-09-04 19:01:18 -05:00
mahkoh
89b7f5f382
Fix module resolution in inner modules with paths ( #4194 )
2020-09-04 19:01:18 -05:00
Caleb Cartwright
48f6c32ec1
tests: add system tests for inverted span issue
2020-08-09 14:32:34 -05:00
Caleb Cartwright
bf359c6ebc
chore: backport 8157a3f0afe978d3e953420577f8344db7e905bf
2020-07-15 09:19:21 -05:00
Seiichi Uchida
a36e7c7981
Use correct span for match arms with the leading pipe and attributes ( #3975 )
2020-06-27 12:55:15 -05:00
Caleb Cartwright
796d6eafa4
fix: backport fix for #4079
2020-06-11 23:29:51 -05:00
Caleb Cartwright
5db7152962
fix: backport fix for #4020
2020-06-11 23:17:38 -05:00
Caleb Cartwright
ce1a3efff0
fix: backport fix for submod parser errors
2020-06-11 21:49:40 -05:00
Caleb Cartwright
dead3a807d
fix: backport mod resolution error handling
2020-06-11 21:11:18 -05:00
Caleb Cartwright
c1267303bc
fix: formatting arbitrary extern abi ( #4089 )
2020-03-31 15:30:26 +09:00
Caleb Cartwright
00e199c974
backport new syntax to rustfmt 1.x ( #4105 )
...
* feat: support raw reference operator
* feat: support const opt-out syntax
* feat: support half open range syntax
2020-03-31 15:28:01 +09:00
Caleb Cartwright
b173b42354
refactor: rename libsyntax --> rustc_ast
2020-03-27 22:29:12 -05:00
Caleb Cartwright
c1a66e1e22
fix: unreachable err on Fn with None
block
2020-03-27 22:13:46 -05:00
Caleb Cartwright
c60416ed21
deps: update rustc-ap to v642.0.0
2020-02-08 22:21:37 -06:00
Seiichi Uchida
731f15551b
Do not add block around async closure ( #3946 )
2019-12-03 08:47:25 +09:00
Seiichi Uchida
69cf48344b
fix handling of nested comments in patterns and ControlFlows ( #3869 )
2019-10-25 15:04:33 +09:00
rChaser53
233497aceb
fix Unparsable code when formmating ( #3883 )
2019-10-24 22:16:56 +09:00
Rui
69c7dbcd50
Try to solve issue3456. ( #3556 )
2019-10-19 18:19:47 +09:00
Stéphane Campinas
5327c3633f
handle field attributes when aligning a struct's fields ( #3513 )
2019-10-19 16:56:32 +09:00
Caleb Cartwright
fd6e960648
fix: comments between lhs and rhs
2019-10-17 20:13:11 -05:00
Caleb Cartwright
28be77915f
fix: nested comments in control flow condition pat
2019-10-17 19:58:08 -05:00
Stéphane Campinas
a15e97f1e9
do not indent impl generics ( #3856 )
2019-10-11 18:19:44 +09:00
Caleb Cartwright
8210cc1c13
fix: handle lhs unary in range expression ( #3855 )
2019-10-11 18:15:04 +09:00
rChaser53
396a2af181
fix to swallow attribute on brace expression ( #3848 )
2019-10-10 10:35:34 +09:00
Caleb Cartwright
207a58f365
fix panic on closure with empty block expr ( #3846 )
2019-10-08 11:00:31 +09:00
Caleb Cartwright
6dcbc5d78e
fix: handle block comments with trailing line comments ( #3842 )
2019-10-08 10:12:21 +09:00
Stéphane Campinas
8073244420
improve detection of URL inside a string that is being rewritten. ( #3809 )
2019-10-07 16:43:50 +09:00
Stéphane Campinas
160c3aafc5
handle hard tabs when formatting trailing comments ( #3836 )
2019-10-07 16:40:27 +09:00
Caleb Cartwright
ba4bf03d84
don't fail on recoverable parser errors in ignored files ( #3782 )
2019-10-07 10:24:08 +09:00
Caleb Cartwright
ed697c9347
fix: support raw prefix identifiers in statics
2019-10-05 12:34:48 -05:00
Stéphane Campinas
fb01dc857c
do not force comments to be indented with a comment trailing a line of code ( #3833 )
2019-10-05 00:22:01 +09:00
rChaser53
7926851bb0
stop to strip 'impl' from impl trait type alias ( #3816 )
2019-10-04 11:25:16 +09:00
Stéphane Campinas
dbd8936391
fix rust code in comment with a line containing only a hash sign ( #3818 )
2019-10-02 23:58:25 +09:00
Caleb Cartwright
634e2441c4
tests: add more merge_import tests for #3808
2019-09-26 20:11:11 -05:00
Caleb Cartwright
7c9c0d1a39
fix: merge_imports handling of ::{self}
2019-09-26 20:02:41 -05:00
topecongiro
ee38d02591
Cargo fmt
2019-09-24 09:26:50 +09:00
Caleb Cartwright
3bb266180e
fix: handling of empty str for license template path ( #3804 )
2019-09-24 09:24:05 +09:00
Caleb Cartwright
6b0a447150
feat: support parameter attributes ( #3793 )
2019-09-20 16:11:52 +09:00
rChaser53
4449250539
fix the error with long string in raw string ( #3800 )
2019-09-18 22:39:27 +09:00
rChaser53
789a097a71
fix internal error when using rustfmt::skip with newline on stmt ( #3785 )
2019-09-15 23:45:46 +09:00
Caleb Cartwright
dfe87fe946
fix: async expression indentation ( #3789 )
2019-09-11 09:55:18 +09:00
Seiichi Uchida
5baba86fe5
Update rustc-ap-* crates to 581.0.0 ( #3783 )
2019-09-06 22:41:03 +09:00
rChaser53
1ded995ee7
fix 'left behind trailing whitespace' ( #3761 )
2019-09-05 19:38:00 +09:00
Seiichi Uchida
783948fcbb
Fix handling of match arm's rewrite ( #3775 )
2019-09-05 11:15:46 +09:00
CreepySkeleton
e81ec20af0
Add --config command line option ( #3767 )
2019-09-05 11:15:19 +09:00
Valentine Valyaeff
15a28f79b8
Another fix for merge_imports
( #3769 )
2019-09-04 23:02:10 +09:00
Andrey
950b288d6f
do not remove discriminant value if exists ( #3771 ) ( #3772 )
2019-09-04 23:01:04 +09:00
rChaser53
2bf67b6e5c
fix TrailingWhitespace when using line breaks in macros arguments ( #3768 )
2019-09-04 23:00:26 +09:00
Caleb Cartwright
ad5d9fba9b
fix formatting mods inside cfg_if macro ( #3763 )
2019-09-02 18:36:51 +09:00
Seiichi Uchida
deb329a6bb
Forbid adding or removing a block from match arms inside macro calls ( #3756 )
2019-08-28 20:50:41 +09:00
rChaser53
a09ca681de
fix the bug removing attrs ( #3760 )
2019-08-28 20:50:02 +09:00
Valentine Valyaeff
ef00f74ce3
Merge imports fix ( #3753 )
2019-08-27 11:23:55 +09:00
Hristo Venev
ac940c7110
Mark toml file as non-executable. ( #3754 )
2019-08-26 09:18:04 +09:00
Caleb Cartwright
9792ff0529
Fix line numbers in checkstyle output ( #3694 )
2019-08-19 11:11:35 +09:00
Seiichi Uchida
1643d726ef
Use correct indent when formatting complex fn type ( #3731 )
2019-08-16 11:15:28 +09:00
Caleb Cartwright
dfd27663dc
add json emit mode ( #3735 )
2019-08-16 11:14:53 +09:00
Seiichi Uchida
4871d6467a
Use the correct BytePos for the opening brace position ( #3742 )
2019-08-13 23:21:55 +09:00
Caleb Cartwright
ac150d016b
fix: remove trailing space with empty dyn macro arg ( #3737 )
2019-08-11 12:49:14 +09:00
Seiichi Uchida
c0cb5eb535
Fix broken tuple pattern ( #3729 )
2019-08-06 11:09:45 +09:00
Igor Matuszewski
62a32e7b83
Fix most recenty nightly breakage due to removed await! support ( #3722 )
2019-08-02 23:54:39 +09:00
rChaser53
3b7a518144
fix underscore in slice patterns are removed ( #3719 )
2019-07-31 23:55:58 +09:00
rChaser53
fe05e88831
fix to build with rustc 1.38.0-nightly ( 4560cb830
2019-07-28) ( #3712 )
2019-07-30 14:32:38 +09:00
rChaser53
da2ed095f3
add test for handling double semicolon ( #3706 )
2019-07-29 05:56:34 +09:00
Seiichi Uchida
983a92c872
Update rustc-ap-* crates to 541.0.0 ( #3707 )
2019-07-29 05:52:45 +09:00
Seiichi Uchida
c0e616bc1d
Implement closing-block procedure without relying on missed_span module ( #3691 )
2019-07-17 23:07:12 +09:00
Michele d'Amico
76e2ba25bd
#3665 : Implemented ( #3689 )
2019-07-17 09:40:33 +09:00
Seiichi Uchida
66c27c9161
Add #[ignore] to test that runs external process ( #3690 )
2019-07-16 19:36:23 +09:00
Seiichi Uchida
89940e541f
Fix bugs related to file-lines ( #3684 )
2019-07-15 22:41:56 +09:00
Stéphane Campinas
6487422b3e
fix print-config minimal option ( #3687 )
2019-07-15 20:58:54 +09:00
rChaser53
71289e1d23
fix 'extra comma inserted due to comment' ( #3677 )
2019-07-14 22:16:47 +09:00
Eric Huss
e55fc6be3b
Fix using --help, --verbose, etc. ( #3620 )
2019-07-14 10:25:53 +09:00
Seiichi Uchida
3200af9785
Do not consider macro-origin await as chain item ( #3671 )
2019-07-06 14:17:53 +09:00
Stéphane Campinas
1f06a8b361
fix extraction of missing comments when rewriting an empty where clause ( #3663 )
2019-06-30 12:19:24 +09:00
calebcartwright
d9e42aea74
tests: add tests for assoscaited_type_bounds fix
2019-06-29 10:11:20 -05:00
rChaser53
9986b9d011
fix internal error for long closure types ( #3653 )
2019-06-25 23:14:19 +09:00
rChaser53
26d370e9e5
remove unreachable!() ( #3646 )
2019-06-23 16:24:40 +09:00
rChaser53
5b0ce0ed12
avoid not to truncate necessary chars ( #3640 )
2019-06-23 14:32:14 +09:00
Seiichi Uchida
1d19a08ed4
Format the last expression-statement as expression ( #3631 )
2019-06-17 08:53:39 +09:00
Stéphane Campinas
84c2356590
handle unicode chars in closures ( #3632 )
...
The `NotUnicode` branch was unecessarily put on a new line, although it
was within max width:
```diff
fn baz() {
let our_error_b = result_b_from_func.or_else(|e| match e {
NotPresent => Err(e).chain_err(|| "env var wasn't provided"),
- NotUnicode(_) => Err(e).chain_err(|| "env var was very very very borkæ–‡å—化ã"),
+ NotUnicode(_) => {
+ Err(e).chain_err(|| "env var was very very very borkæ–‡å—化ã")
+ }
});
}
```
2019-06-17 08:53:17 +09:00
Caleb Cartwright
aa0c9dd212
tests: add normalize_doc_attributes config tests ( #3630 )
2019-06-16 23:46:25 +09:00
Stéphane Campinas
1cea171cef
Improve handling of unicode characters ( #3618 )
2019-06-12 20:28:29 +09:00
Seiichi Uchida
47a11cd516
Format modules defined in cfg_attr ( #3604 )
2019-06-09 09:20:39 +09:00
Seiichi Uchida
e71bffb008
Format modules defined inside cfg_if macro calls ( #3600 )
2019-06-08 18:47:18 +09:00
Stéphane Campinas
87565c42ce
Merge pull request #3607 from topecongiro/issue-3493
...
Ignore sub-modules when skip-children is used
2019-06-08 09:50:12 +02:00
topecongiro
788a4cbe4f
Add a test for #3493
2019-06-08 14:52:49 +09:00
Marcel Hellwig
eea8af0183
removed bitrig support ( #3608 )
...
bitrig support has been removed (by me) in https://github.com/rust-lang/rust/pull/60775
2019-06-07 16:56:30 +09:00
rChaser53
5607178d0a
fix the bug add unwanted code to impl ( #3601 ) ( #3602 )
2019-06-06 13:06:40 +09:00
Stéphane Campinas
e0459eb3fe
inline the attribute with its item even with the macro_use attribute or when reorder_imports is disabled ( #3598 )
2019-06-05 00:14:12 +09:00
Seiichi Uchida
2244f326e6
Cargo update ( #3559 )
...
Update `rustc-ap-*` crates to 486.0.0.
2019-06-03 23:57:02 +09:00
Stéphane Campinas
e6b60a40d5
stabilise fn_args_density ( #3581 )
2019-06-03 22:26:48 +09:00
rchaser53
0c30bd3b47
add tests for issue-3595
2019-05-30 21:03:29 +09:00
Stéphane Campinas
6d19a8c71d
Merge pull request #3586 from topecongiro/issue-3584
...
Format trait aliases with where clauses
2019-05-30 09:39:15 +02:00
rChaser53
fbd9f335f9
fix Erasing inner attributes in struct ( #3593 )
2019-05-30 07:31:48 +09:00
topecongiro
1c1b4f76bd
Add a test for #3583
2019-05-28 00:03:42 +09:00
topecongiro
264417e10d
Add tests for trait aliases with where clauses
2019-05-26 21:14:59 +09:00
Seiichi Uchida
b5449ba785
Allow overflowing rhs of unit variant ( #3566 )
2019-05-22 10:51:19 +09:00
Seiichi Uchida
72ca0e5f2c
Merge pull request #3577 from topecongiro/issue-3575
...
Insert an empty line when normalizing `#[doc = ""]`
2019-05-22 10:49:12 +09:00
topecongiro
2445f0ea76
Add a test for #3575
2019-05-22 00:10:35 +09:00
rchaser53
bee1a32f26
add the handling for vec! with paren inside macro
2019-05-22 00:07:56 +09:00
rChaser53
0ef2144c82
not to avoid self ( #3570 )
2019-05-21 11:43:27 +09:00
Ruben Schmidmeister
9b98dd774e
Merge branch 'master' into normalize-multiline-doc-attributes
2019-05-18 11:27:35 +02:00
rchaser53
bdf105245b
fix Const generics are handled incorrectly
2019-05-16 13:22:25 +09:00
Seiichi Uchida
531b2d9136
Merge pull request #3535 from xiongmao86/issue3417
...
Try to solve issue 3417.
2019-05-16 11:12:56 +09:00
Ruben Schmidmeister
3eb8e4d33c
Ignore unstable key when overriding config
2019-05-13 09:40:16 +02:00
Ruben Schmidmeister
4ac0d35ebb
Only run test on nightly
2019-05-12 23:03:48 +02:00
Ruben Schmidmeister
7fc181d111
Add regression test
2019-05-11 15:03:59 +02:00
xiongmao86
a956a20532
Revert "Revert "Change config option from format_doc_comments to format_code_in_doc_comments.""
...
This reverts commit 97d7216cd4
.
2019-05-10 21:22:52 +08:00
Stéphane Campinas
4bc5911348
Merge pull request #3526 from bash/refactor-apply-newline-style
...
Refactor apply newline style
2019-05-10 09:48:01 +02:00
xiongmao86
97d7216cd4
Revert "Change config option from format_doc_comments to format_code_in_doc_comments."
...
This reverts commit 6a6924c12b
.
2019-05-08 16:51:32 +08:00
xiongmao86
6a6924c12b
Change config option from format_doc_comments to format_code_in_doc_comments.
2019-05-06 19:45:34 +08:00
rchaser53
7a93a26aad
correct to get wrong BytePos
2019-05-06 00:01:13 +09:00
xiongmao86
3300bb22a5
Isolate format_doc_comment with normalize_comments and wrap_comments.
2019-05-02 21:11:13 +08:00
Ruben Schmidmeister
703a2eab19
Merge remote-tracking branch 'origin/master' into refactor-apply-newline-style
2019-05-02 06:47:41 +02:00
xiongmao86
a653e30d9f
Add tests for #3417 .
2019-05-01 16:27:34 +08:00
rchaser53
2c58b205d5
fix Comma in comment causes no formatting
2019-04-29 21:38:38 +09:00
xiongmao86
174f591134
Add a test for #2941 .
2019-04-26 16:04:49 +08:00
Ruben Schmidmeister
19bd1a44ce
Preserve standalone carriage returns on windows also
2019-04-24 21:01:09 +02:00
Seiichi Uchida
a6daccc229
Merge pull request #3523 from topecongiro/issue-3515
...
Attempt to format attributes if only they exist
2019-04-24 07:22:55 -07:00
rChaser53
05547d90b5
leave the comment in parentheses of argumentless Fn ( #3518 )
2019-04-23 16:21:04 -07:00
topecongiro
8d43ca297a
Add and update test for #3515
2019-04-23 08:50:44 +09:00
Seiichi Uchida
5dd042c152
Merge pull request #3511 from topecongiro/issue3498
...
Avoid overflowing item with attributes
2019-04-17 11:40:00 -07:00
Seiichi Uchida
760ec07978
Merge pull request #3510 from topecongiro/issue3509
...
Fix duplication of attributes on a match arm's body
2019-04-17 11:39:44 -07:00
topecongiro
37959a9da7
Add a test for #3498
2019-04-14 20:44:52 +09:00
topecongiro
0d4fb2403c
Add a test for #3509
2019-04-14 20:12:58 +09:00
Seiichi Uchida
378b28b06e
Merge pull request #3495 from scampi/issue-1096
...
keep missed comments appearing after the struct/enum ident
2019-04-10 06:00:51 +09:00
rchaser53
8ffe4146cc
fix not to delete semicolon
2019-04-07 12:31:57 +09:00
Stéphane Campinas
bf383c4610
keep missed comments appearing after the struct/enum ident
2019-04-05 17:11:11 +02:00
Stéphane Campinas
8e068510a4
keep comment appearing between parameter's name and its type ( #3491 )
2019-04-03 18:16:54 +09:00
Christian Duerr
919bee8990
Enable overflow_delimited_expr for structs
...
This fixes https://github.com/rust-lang/rustfmt/issues/3482 .
2019-03-30 18:37:37 +01:00
Shotaro Yamada
c0ff894a22
Fix indexing panic on unicode whitespaces
2019-03-29 20:12:45 +09:00
Seiichi Uchida
17ca7408f3
Do not add a space after empty impl
2019-03-25 11:21:14 +09:00
Seiichi Uchida
288d7db5a9
Merge pull request #3467 from topecongiro/issue-3465
...
Fix bad performance on deeply nested binary expressions
2019-03-25 07:26:04 +09:00
Seiichi Uchida
929d8a9494
Merge pull request #3459 from scampi/issue-3442
...
fix line numbering in missed spans and handle file_lines in edge cases
2019-03-25 07:25:28 +09:00
Stéphane Campinas
cc26c5eaca
Merge pull request #3454 from rchaser53/issue-3434
...
add new attribute rustfmt::skip::macros
2019-03-24 22:29:56 +01:00
topecongiro
04cc821e4a
Add a test for #3465
2019-03-24 18:43:35 +09:00
rchaser53
85b206a32c
add test for visitor mad from same context
2019-03-22 18:20:00 +09:00
rchaser53
bbbc1e86eb
refrect topecongiro reviews
...
- &Vec<syntax::ast::PathSegment> => &[ast::PathSegment]
- remove unnecessary implements
- transfer skip logic to inside rewrite_macro
- fix test
- use util methods in libsyntax
- use meta_item_list directly
- avoid no_entry.rs for test using module system
- add logic to skip rustfmt::skip::macros only
- remove base_skip_macro_names
- remove Rc
- use clone to append skip_macro_names
2019-03-21 21:45:39 +09:00
Seiichi Uchida
94b381f1cc
Merge pull request #3464 from topecongiro/issue-3463
...
Avoid duplication on the presence of spaces between macro name and !
2019-03-21 20:32:29 +09:00
topecongiro
017e491a17
Avoid duplication on the presence of spaces between macro name and !
2019-03-21 15:58:39 +09:00
Stjepan Glavina
1fa06ecf1e
Fix formatting of async blocks
2019-03-20 18:18:02 +01:00
rchaser53
1f8553d66f
add new attribute rustfmt::skip::macros
...
add test for function not having attribute
2019-03-21 00:18:51 +09:00
Stéphane Campinas
cdd08da27b
fix line numbering in missed spans and handle file_lines in edge cases
...
- a leading/trailing newline character in missed spans was throwing off the
start/end of ranges used to compare against file_lines
- fix handling of file_lines when closing a block
Close #3442
2019-03-19 10:19:45 +01:00
Seiichi Uchida
c9479de9a7
Avoid panic on macro inside deeply nested block
...
Closes #3457 .
2019-03-19 10:50:44 +09:00
Seiichi Uchida
f048fc0fde
Merge pull request #3448 from topecongiro/use-new_sub_parser_from_file
...
Support path clarity module even when we start from internal module
2019-03-17 14:04:11 +09:00
Seiichi Uchida
ad6d89842a
Merge pull request #3453 from scampi/issue-3423
...
remove trailing whitespaces in missing spans
2019-03-17 14:01:49 +09:00
topecongiro
7fc4e418bf
Tweak test settings
2019-03-17 12:33:18 +09:00
topecongiro
9d281b44c3
Add a test for #3427
2019-03-17 12:21:21 +09:00
Stéphane Campinas
2d5bc69475
remove trailing whitespaces in missing spans
2019-03-16 12:23:02 +01:00
Seiichi Uchida
ce5cccc32c
Update rustc-ap-* crates to 407.0.0 ( #3447 )
2019-03-14 22:50:53 +09:00
Seiichi Uchida
331a0500ce
Merge pull request #3441 from rchaser53/const-generics
...
implement for const generics
2019-03-14 22:50:20 +09:00
rchaser53
f0c861bfa9
implement for const generics
2019-03-13 03:58:23 +09:00
Seiichi Uchida
5f3dfe6c51
Format the if expression at the end of the block in a single line ( #3338 )
2019-03-11 23:18:43 +09:00
rchaser53
40ff078abf
fix 'Ident of macro+ident gets duplicated' error
2019-03-10 22:58:34 +09:00
rchaser53
8e3ef3e3a9
fix not to remove comment in the case of no arg
2019-03-05 00:18:33 +09:00
rchaser53
dec3902076
leave post comment for self
2019-03-02 17:33:43 +09:00
rchaser53
ae7330eea4
leave pre comment for self
2019-02-24 22:05:08 +09:00
rchaser53
0e408bf83c
add config inline_attribute_width
...
If the line width is width within config width, attribute is inline.
I don't want to change default rustfmt behavior, so config default value is 0.
- fix description
- fix test comment
- remove unnecessary clone
- remove unnecessary test file
- fix test for β version
- attributes => attribute
2019-02-23 13:40:11 +09:00
Alexander Regueiro
7a3b7c9275
Various cosmetic improvements ( #3403 )
2019-02-19 11:56:42 +09:00
Stéphane Campinas
e5284b1377
Merge pull request #3334 from rchaser53/issue-3227
...
fix Inconsistency between loop and while
2019-02-15 13:12:42 +01:00
rchaser53
c4b6b52ada
remove tests/source/issue-3227/one.rs
2019-02-15 18:11:49 +09:00
rchaser53
7d9a2ef96d
version/2: Align loop and while formatting
...
The loop and while formatting was diverting as `loop`
was not being moved to a new, indented block, as `while`
was.
This commit fixes this inconsistency but pins it to version 2
to avoid changing existing code.
2019-02-14 10:06:29 +09:00
topecongiro
96a3df3b5c
Format visibility on trait alias
2019-02-12 10:16:12 +09:00
topecongiro
9a7ea6aacb
Handle a macro argument with a single keyword
...
Closes #3331 .
2019-02-11 00:34:23 +09:00
Seiichi Uchida
c4611a0e6b
Merge pull request #3326 from scampi/issue-3302
...
fix formatting of strings within a macro
2019-02-11 00:32:06 +09:00
Seiichi Uchida
44d6f7c43e
Merge pull request #3332 from rchaser53/issue-3234
...
add issue-3234 test
2019-02-08 12:35:50 +09:00
Seiichi Uchida
672f352c89
Merge pull request #3325 from topecongiro/rustcap
...
Update rustc-ap-* crates to 366.0.0
2019-02-08 00:24:57 +09:00
rchaser53
5e530980b7
add issue-3234 test
...
this issue is already resolved
2019-02-08 00:05:54 +09:00
Stéphane Campinas
4ed31b606d
Merge pull request #3322 from fyrchik/fix/3304
...
calculate statement first line properly
2019-02-07 10:51:08 +01:00
Evgenii
109394536d
add more tests
2019-02-07 12:12:36 +03:00
Evgenii
2502939b60
fix review comments
2019-02-07 10:55:55 +03:00
Stéphane Campinas
813aa79567
fix formatting of strings within a macro
2019-02-07 00:05:05 +01:00
Seiichi Uchida
1ae032652c
Add a test for #3313
2019-02-06 23:10:27 +09:00
Evgenii
da2d8a4c57
calculate statement first line properly
2019-02-06 10:05:51 +03:00
Stéphane Campinas
4c5ef9a2f5
remove unecessary source test file
2019-02-05 21:19:41 +01:00
rchaser53
5fcb7507ca
fix Removed indentation after nested comments error
2019-02-05 13:12:45 +09:00
Seiichi Uchida
bfcfaf1743
Merge pull request #3308 from topecongiro/issue-2835
...
Prioritize single_line_fn and empty_item_single_line over brace_style
2019-02-04 00:11:01 +09:00
Seiichi Uchida
efd6fda43f
Merge pull request #3311 from rchaser53/issue-3295
...
fix "internal error: left behind trailing whitespace" with long lines
2019-02-04 00:10:42 +09:00