Commit Graph

47 Commits

Author SHA1 Message Date
rChaser53
2bf67b6e5c fix TrailingWhitespace when using line breaks in macros arguments (#3768) 2019-09-04 23:00:26 +09:00
Michele d'Amico
76e2ba25bd #3665: Implemented (#3689) 2019-07-17 09:40:33 +09:00
Ruben Schmidmeister
618d092bf7
Enable unreachable_pub lint 2019-05-09 20:37:51 +02: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
rchaser53
f493a59783 use RefCell and Rc 2019-03-21 00:19:52 +09:00
rchaser53
1f8553d66f add new attribute rustfmt::skip::macros
add test for function not having attribute
2019-03-21 00:18:51 +09:00
Alexander Regueiro
7a3b7c9275 Various cosmetic improvements (#3403) 2019-02-19 11:56:42 +09:00
Hirokazu Hata
4bb90f5cc8 Fix rust_2018_idioms warnings 2019-02-09 16:14:30 +09:00
Evgenii
ece629b1cc transition to Rust 2018 2019-02-04 13:30:43 +03:00
Otavio Salvador
6391b7ab35 rewrite: adjust comment as it refers to is_if_else_block
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2018-10-11 10:37:15 -03:00
Seiichi Uchida
755d27a424 Take impl Iterator for overflow routines 2018-09-29 14:33:00 +09:00
cad97
fc1909d311 Reformat 2018-08-23 17:14:19 -04:00
cad97
04d804c365 Rename CodeMap/FileMap to SourceMap/SourceFile
#2946
2018-08-23 17:10:46 -04:00
Seiichi Uchida
94e68b1eb6 Set the flag in RewriteContext when rewriting macro call failed 2018-06-07 12:32:10 +09:00
Nick Cameron
abb253df8b Rationalise result and error types 2018-05-21 08:58:53 +12:00
Shotaro Yamada
d1e2b80fb9 Use saturating_sub 2018-05-15 20:41:43 +09:00
Nick Cameron
390a284851 Give a deprecation warning on rustfmt_skip and an error on rustfmt:: other than skip 2018-05-14 18:10:46 +12:00
Seiichi Uchida
903de92dae Avoid cloning RewriteContext 2018-03-25 20:20:50 +09:00
Seiichi Uchida
8943c376bc Use RefCell for RewriteContext fields 2018-03-09 14:07:05 +09:00
Nick Cameron
39301ae5f2 Go back to a non-workspace structure
Kinda reverts https://github.com/rust-lang-nursery/rustfmt/pull/2419
2018-03-02 14:58:23 +13:00
topecongiro
4af2aa3a9e Create rustfmt_core crate 2018-02-07 22:48:05 +09:00
Seiichi Uchida
1d9a10e00e Use explicit lifetime to get rid of unsafe code
at least this is why we use Rust
2017-12-07 13:57:54 +09:00
Seiichi Uchida
0928762562 Use SnippetProvider in FmtVisitor and RewriteContext 2017-12-06 22:49:49 +09:00
topecongiro
04f09c9d85 Replace '*_indent' with 'indent_style' in src 2017-11-13 17:33:32 +09:00
topecongiro
d5d8740993 Rename 'fn_call_style' to 'fn_call_indent' 2017-11-04 22:46:40 +09:00
Seiichi Uchida
df7d2be562 Move Indent and Shape to shape.rs from lib.rs 2017-09-19 10:04:35 +09:00
topecongiro
f8586bac2a Handle comment at the last element in write_list 2017-07-05 18:01:34 +09:00
topecongiro
b49269ad39 Forbid method chain to get combined if it uses multi line.
If the method chain goes multi line before the last element, disallow combining
the method chain.
2017-06-04 19:37:24 +09:00
topecongiro
fef347cb9e Add use_block_indent method to RewriteContext 2017-06-04 19:35:29 +09:00
topecongiro
aadd3e11f4 Unindent comment on top of else 2017-06-02 11:58:58 +09:00
Seiichi Uchida
789abf063d Use block indent style when visual indent failed 2017-06-01 12:08:20 +09:00
Seiichi Uchida
7ec78711f2 Prevent rewriting closure block to expr inside macro 2017-05-13 18:32:25 +09:00
Nick Cameron
b35906dbce WIP 2017-02-21 16:35:05 +13:00
Nick Cameron
428339fdc3 Refactor indent and width into Shape struct 2017-01-31 08:35:23 +13:00
Nick Cameron
4c3228530f block indent large closures
somewhat rough around the edges
2016-04-22 11:29:01 +12:00
Eli Friedman
1c235de97d Fix crash speculatively parsing macro arguments as expressions.
The problem is essentially that if we try to parse a token tree using a
CodeMap different from the one the tree was originally parsed with,
spans become nonsense. Since CodeMaps can't be cloned, we're basically
forced to use the original ParseSess for additional parsing.

Ideally, rustfmt would be a bit more clever and figure out how to parse
macro arguments based on the definition of the macro itself, rather than
just guessing that a particular token sequence looks like an expression,
but this is good enough for now.

Fixes #538.
2015-10-27 23:41:32 -07:00
Marcus Klaas
3970748f59 Remove overflow indentation 2015-10-19 23:06:36 +02:00
Pavel Sountsov
03e1b27826 Add Indent::none(), remove make_indent. 2015-09-19 10:36:45 -07:00
Pavel Sountsov
d4108a3029 Initial implementation of hard tab indentation. 2015-09-19 10:36:45 -07:00
Nick Cameron
183dac91a3 Fix a bug where struct lits nested in fn calls were over-indented 2015-09-02 15:36:17 +12:00
Nick Cameron
a5f8b37eeb Format match expressions properly when they appear on an overflowing line. 2015-09-02 14:29:47 +12:00
Gaëtan Cassiers
5e445697ce Implement Rewrite for [ast::Attribute] 2015-08-27 22:29:07 +02:00
Nick Cameron
dc2544712c Rewrite match expressions 2015-08-20 08:08:11 +12:00
Marcus Klaas
b473c2bd2a Format loops 2015-07-15 23:33:01 +02:00
Marcus Klaas
d7b49fd76c Remove global mutable config to allow for concurrency 2015-06-23 13:26:04 +02:00
Gaëtan Cassiers
ad658885d4 Comments for Rewrite 2015-06-23 02:15:46 +02:00
Gaëtan Cassiers
c012d311c4 A basic impl of Rewrite for ast::Expr 2015-06-23 02:15:46 +02:00