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
d122ad5adc
Address some issues with multiline patterns in let statements
2015-10-24 13:13:15 +02:00
Ravi Shankar
d135217db2
show rustfmt coverage!
2015-10-24 15:22:37 +05:30
Alex Crichton
579fb34417
Remove dependence on rustc/rustc_driver, use syntex
...
Instead just parse manually with the `syntex_syntax` crate which is a clone of
libsyntax on crates.io which builds on stable Rust.
2015-10-23 13:46:14 -07:00
Alex Crichton
36abfe5dc2
Remove usage of many unstable features
...
This removes usage of:
* PathExt
* split_last
* split_last_mut
* catch_panic
The catch_panic one was a little tricky as the ident interner needed to be
cloned across threads (a little unsafely), but it should otherwise be good to
go.
2015-10-23 13:46:14 -07:00
Marcus Klaas
ca023ba9b7
Format some patterns
2015-10-19 20:15:36 +02:00
Marcus Klaas
199d40fa55
Increase default function call width limit
2015-10-06 22:27:11 +02:00
Marcus Klaas
965ea09664
Split ListTactic decision logic from write_list
2015-10-04 20:40:14 +02:00
Tim Kuehn
6c6e7194c2
Fix 1-tuple regression.
...
Add test to prevent future regressions.
2015-10-01 11:06:49 -07:00
Marcus Klaas de Vries
afee62e476
Merge pull request #370 from marcusklaas/match-arm-delining
...
Improve heuristics for match arm body placement
2015-09-27 12:00:57 +02:00
Marcus Klaas
2d4a0cbe3b
Fix match arm indentation bug
2015-09-26 23:18:57 +02:00
Nick Cameron
617eed353c
Changes to rustfmt source
2015-09-26 18:29:48 +12:00
Nick Cameron
99d71a164a
Changes to source formatting
2015-09-26 13:58:12 +12: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
Marcus Klaas
e72d488281
Refactor test code
...
No longer use callbacks or thread::catch_panic; reduce stdout spew; guard against rustfmt breaking the column limit.
2015-09-18 22:34:46 +02:00
Marcus Klaas
110f7206e6
Split formatting function from side effects
...
This makes rustfmt more usable as a library.
2015-09-18 22:31:33 +02:00
Marcus Klaas
f751356910
Format macro invocations
2015-09-16 20:26:14 +02:00
Nick Cameron
a29023a191
Remove a few unnecessary rustfmt_skip
s
2015-09-15 11:46:27 +12:00
Marcus Klaas
03c660633f
Refine chain breaking heuristics
...
Don't make a single line chain when it is was multi line in the source; allow overflow of the last chain element onto the next lines without breaking the chain.
2015-09-11 00:53:01 +02:00
Marcus Klaas
c680bb4030
Implement basic chain formatting
2015-09-11 00:52:16 +02:00
Sinh Pham
e7a5f9327e
Add diff write mode https://github.com/nrc/rustfmt/issues/261
2015-09-10 18:30:07 -04:00
Nick Cameron
8750399ef4
Merge pull request #248 from sinhpham/unicode_string_lit
...
Unicode string lit
2015-09-07 08:01:06 +12:00
Andre Bogus
d6c652e33c
code improvements suggested by clippy
2015-09-04 23:39:33 +02:00
Sinh Pham
61f642f6f8
Support unicode in string literals.
2015-09-03 23:41:25 -04:00
Nick Cameron
fae93abbda
Support struct-like layouts for fn args
2015-09-02 09:41:08 +12:00
Marcus Klaas
120fd2426e
Format assignment
2015-08-25 21:43:13 +02:00
Nick Cameron
43ad7ad7a0
Re-jig binop formatting
...
and misc other fixes from the reviews.
2015-08-20 08:18:02 +12:00
Nick Cameron
81f2e449d7
Handle span error with continue
...
This should be properly addressed by #184 , but requires a change to the rustc parser, so this patch just works around the issue.
2015-08-20 08:11:14 +12:00
Nick Cameron
a43e2b5ae8
Formatting
2015-08-20 08:11:14 +12:00
Marcus Klaas
8e22a73cb7
Add option to override single configuration lines for tests
2015-08-19 21:51:03 +02:00
Marcus Klaas
10a80bb8be
Add an option to forgo backups
2015-08-19 21:31:27 +02:00
Gaëtan Cassiers
5b5927996f
Kill ChangeSet and replace remaining part by FileMap
...
Also fix style issues
Cargo update to get fixes of strings.rs (was cause of a misformatted
function call).
2015-08-02 13:33:01 +02:00
Gaëtan Cassiers
0eab4bf430
Remove ChangeSet of FmtVisitor
2015-08-02 13:12:51 +02:00
Gaëtan Cassiers
0e10329dc7
Separate modules and files listing of reformatting
...
As suggested in #141
Closes #156
2015-08-02 13:07:27 +02:00
Nick Cameron
8461e8a0a8
Merge pull request #147 from marcusklaas/even-more-expr
...
Format if expressions & loops
2015-07-25 09:51:59 +12:00
Marcus Klaas
c4101de53d
Refactor some things; add extra tests.
2015-07-24 19:00:14 +02:00
Nick Cameron
c10c732425
Simplify CompilerCalls impl
2015-07-23 08:07:57 +12:00
Marcus Klaas
2fa6220f57
Format all the loops!
2015-07-19 23:43:32 +02:00
Nick Cameron
979d0c9756
Resolve some warnings
2015-07-17 18:26:10 +12:00
Nick Cameron
c3375078e5
Merge pull request #137 from nrc/struct-lit-opt
...
Options for formatting struct literals
2015-07-17 06:57:01 +12:00
Nick Cameron
9ab1587a98
Don't apologise if its not our fault in warnings
2015-07-16 14:17:07 +12:00
Nick Cameron
7518f68861
Add an option to format struct lits with either block or visual indent
2015-07-16 14:05:05 +12:00
Gaëtan Cassiers
3de366d282
Format modules into separate files
2015-07-03 11:12:21 +02:00
Marcus Klaas
482f200b0b
Update import list formatting
...
Include comments and sort items alphabetically.
2015-06-26 03:43:12 +02:00
Marcus Klaas
0ef5db9496
Format tuple-like structs
2015-06-23 16:54:42 +02:00
Marcus Klaas
d7b49fd76c
Remove global mutable config to allow for concurrency
2015-06-23 13:26:04 +02:00
Gaëtan Cassiers
c012d311c4
A basic impl of Rewrite for ast::Expr
2015-06-23 02:15:46 +02:00
Marcus Klaas
5924b83829
Rustup
2015-06-22 14:52:23 +02:00
Marcus Klaas
d335d04575
Implement checks for unnumbered TODOs and FIXMEs
2015-06-12 20:58:23 +02:00
Gaëtan Cassiers
4d6d0b81a7
Fix mod ordering + formatting
2015-06-08 20:23:24 +02:00
Gaëtan Cassiers
adedba45a8
Use impl_enum_decodable for SeparatorTactic
2015-06-08 19:40:22 +02:00
Marcus Klaas
227322ddba
Add macro for enum implementations of Decodable
2015-06-04 14:08:32 +02:00
Nick Cameron
e7adf64155
Format structs
2015-05-25 17:07:55 +12:00
Nick Cameron
6a5ef17eb1
Add config.rs which I forgot for the last commit
...
Closes #73
2015-05-23 22:25:36 +12:00
Nick Cameron
1a09a6d00a
Use config file for constants
2015-05-23 17:53:53 +12:00
Alex HotShot Newman
2fbb445b67
Remove old box syntax
2015-05-20 11:20:15 -07:00
Oliver Schneider
cd3b032e11
prevent bogus whitespace error messages due to \r
2015-05-04 14:32:48 +02:00
Oliver Schneider
1655583b02
handle windows newlines
2015-05-04 12:50:24 +02:00
Oliver Schneider
62e583d4cf
split main function and test function into their own files
...
small modifications to make executable and test compile properly
2015-05-01 22:28:58 +02:00
Oliver Schneider
e6e7ce178f
main.rs -> lib.rs
2015-05-01 22:24:53 +02:00