Commit Graph

34 Commits

Author SHA1 Message Date
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