Commit Graph

780 Commits

Author SHA1 Message Date
Yacin Tmimi d41805704d Prevent structs with ".." from being rewritten with alignment
rustfmt should only support rewriting a struct in an expression
 position with alignment (non-default behavior) when there is no rest
 (with or without a base) and all of the fields are non-shorthand.
2021-10-12 19:37:48 -05:00
Arjen Laarhoven 9d65b7dcd1 feat: upper- or lowercase hexadecimal literals 2021-09-14 21:22:26 -05:00
Matthias Krüger 4c2959fb12 fix a bunch of clippy warnings
clippy::bind_instead_of_map
clippy::branches_sharing_code
clippy::collapsible_match
clippy::inconsistent_struct_constructor
clippy::int_plus_one
clippy::iter_count
clippy::iter_nth_zero
clippy::manual_range_contains
clippy::match_like_matches_macro
clippy::needless::collect
clippy::needless_question_mark
clippy::needless_return
clippy::op_ref
clippy::option_as_ref_deref
clippy::ptr_arg
clippy::redundant_clone
clippy::redundant_closure
clippy::redundant_static_lifetimes
clippy::search_is_some
clippy::#single_char_add_str
clippy::single_char_pattern
clippy::single_component_path_imports
clippy::single_match
clippy::skip_while_next
clippy::unnecessary_lazy_evaluations
clippy::unnecessary_unwrap
clippy::useless_conversion
clippy::useless_format
2021-07-25 22:53:32 -05:00
Ryan Levick 58c63cf8de Add support for using qualified paths with structs in expression and pattern
position.
2021-06-10 13:18:41 +02:00
Caleb Cartwright 1bcc1f8df5 refactor: apply heuristic config changes in lib 2021-04-21 21:27:50 -05:00
Caleb Cartwright c32f2ec015 chore: fmt and cleanup 2021-04-02 23:21:06 -05:00
Caleb Cartwright 4948911608 deps: apply rustc-ap-* v712 changes 2021-04-02 23:21:06 -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
Caleb Cartwright b8f318c303 fix: don't insert trailing comma on struct lit rest in mac def 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
Caleb Cartwright bd4dc36c4e refactor: cleanup block check for statements 2021-01-27 20:58:42 -06:00
Caleb Cartwright 48d30a4f71 chore: run rustfmt against source 2020-11-28 17:41:21 -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
Ayaz Hafiz ce13ff15c3 Correctly create artificial span for formatting closure body
This commit partially reverts #3934, opting to create a span that covers
the entire body of a closure when formatting a closure body with a
block-formatting strategy, rather than having the block-formatting code
determine if the visitor pointer should be rewound. The problem with
rewinding the visitor pointer is it may be incorrect for other (i.e.
non-artificial) AST nodes, as in the case of #4382.

Closes #4382
2020-11-14 11:50:28 -06:00
Caleb Cartwright 31cef56779 feat: add initial support for ConstBlock expressions 2020-10-24 11:13:00 -05:00
Caleb Cartwright a17803127f fix: inverted span on attrs within closure 2020-08-09 14:32:34 -05:00
Caleb Cartwright b28fd5f91c deps: apply upstream rustc-* changes 2020-06-11 13:22:37 -05: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 ac2d5b85a5 deps: bump rustc-ap* to v651 2020-03-30 12:02:39 -05:00
Caleb Cartwright b173b42354 refactor: rename libsyntax --> rustc_ast 2020-03-27 22:29:12 -05:00
Caleb Cartwright 9b0ed57af6 refactor: parse & mod resolver for rustc-ap v650 2020-03-27 21:33:34 -05:00
Caleb Cartwright bd5dff4012 refactor: backport syntux mod 2020-03-26 21:25:34 -05:00
Caleb Cartwright 760bb29feb chore: fix compile warnings 2020-02-08 22:54:37 -06:00
Caleb Cartwright c60416ed21 deps: update rustc-ap to v642.0.0 2020-02-08 22:21:37 -06:00
Seiichi Uchida 69cf48344b fix handling of nested comments in patterns and ControlFlows (#3869) 2019-10-25 15:04:33 +09:00
Rui 69c7dbcd50 Try to solve issue3456. (#3556) 2019-10-19 18:19:47 +09:00
Caleb Cartwright fd6e960648 fix: comments between lhs and rhs 2019-10-17 20:13:11 -05:00
Caleb Cartwright 8210cc1c13 fix: handle lhs unary in range expression (#3855) 2019-10-11 18:15:04 +09:00
Seiichi Uchida 383306e5fe Update rustc-ap-* crates to 606.0.0 (#3835) 2019-10-05 23:40:24 +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
Seiichi Uchida ceca01465a Update deps (#3788) 2019-09-08 23:33:21 +09:00
Seiichi Uchida 5baba86fe5 Update rustc-ap-* crates to 581.0.0 (#3783) 2019-09-06 22:41:03 +09:00
Igor Matuszewski 62a32e7b83 Fix most recenty nightly breakage due to removed await! support (#3722) 2019-08-02 23:54:39 +09:00
Seiichi Uchida 983a92c872 Update rustc-ap-* crates to 541.0.0 (#3707) 2019-07-29 05:52:45 +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
Stéphane Campinas 1cea171cef Improve handling of unicode characters (#3618) 2019-06-12 20:28:29 +09:00
Seiichi Uchida 2244f326e6 Cargo update (#3559)
Update `rustc-ap-*` crates to 486.0.0.
2019-06-03 23:57:02 +09:00
rChaser53 fbd9f335f9 fix Erasing inner attributes in struct (#3593) 2019-05-30 07:31:48 +09:00
Seiichi Uchida b5449ba785 Allow overflowing rhs of unit variant (#3566) 2019-05-22 10:51:19 +09:00
Ruben Schmidmeister 618d092bf7 Enable unreachable_pub lint 2019-05-09 20:37:51 +02:00
Seiichi Uchida 5dd042c152 Merge pull request #3511 from topecongiro/issue3498
Avoid overflowing item with attributes
2019-04-17 11:40:00 -07:00
topecongiro d3e578b131 Avoid overflowing item if it has attributes 2019-04-14 20:45:04 +09: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 9fda937779 Remove redundant & 2019-03-29 19:17:50 +09:00
Shotaro Yamada ff0683d666 Simplify iterators 2019-03-29 19:06:32 +09:00
Stjepan Glavina 1fa06ecf1e Fix formatting of async blocks 2019-03-20 18:18:02 +01:00