Kamal Marhubi
ed27b4799a
codemap: Add utilities for looking up line ranges of spans
...
This commit adds extension methods to `Codemap` to allow looking up line
ranges for spans.
Refs #434
2016-05-31 00:49:31 +02:00
Kamal Marhubi
bd10af127e
utils: Move codemap related utilities to a dedicated module
...
This commit adds a `codemap` module, and moves the `CodemapSpanUtils`
added in #857 to it. This is preparation for adding more `Codemap`
specific utilities.
Refs #434
2016-05-31 00:49:26 +02:00
Kamal Marhubi
80c56a01ff
visitor: Add debug log for FmtVisitor::visit_stmt()
2016-05-31 00:43:48 +02:00
Kamal Marhubi
7f0d87cc51
Derive Debug for the Input enum
2016-05-31 00:43:48 +02:00
Nick Cameron
5436977bd5
Merge pull request #1017 from marcusklaas/tweak-if-else
...
Format non-statement if-else expressions on a single line
2016-05-31 01:57:29 +12:00
Nick Cameron
3a87aa5318
Merge pull request #1022 from kamalmarhubi/update-syntex-syntax
...
deps: Update syntex_syntax to 0.33
2016-05-31 01:25:09 +12:00
Nick Cameron
0678152e73
Merge pull request #1015 from srinivasreddy/readme
...
Add section - Installing from source
2016-05-31 01:24:07 +12:00
Kamal Marhubi
120e1a0b51
deps: Update syntex_syntax to 0.33
...
This bump brings syntex_syntax support for `..` in tuple and tuple
struct patterns, which come from RFC 1492:
https://github.com/rust-lang/rfcs/blob/master/text/1492-dotdot-in-patterns.md
These new patterns are not properly handled in this PR; instead #1021
tracks supporting them.
Refs #1021
2016-05-30 14:53:04 +02:00
Marcus Klaas
98c0570a28
Format non-statement if-else expressions on a single line
2016-05-29 17:58:38 +02:00
Nick Cameron
bbb6038b92
Treat chains with just expr? specially.
...
Fixes #1004
2016-05-29 09:32:48 +01:00
Srinivas Reddy Thatiparthy
18489b3648
Add section - Installing from source
2016-05-28 21:08:33 +05:30
Kamal Marhubi
66cac1f3e9
Handle pub(restricted) ( #1013 )
...
* Handle pub(restricted)
This commit properly handles pub(restricted) as introduced in RFC 1422
[0]. The syntax support was added in #971 , but they were not correctly
formatted.
[0] https://github.com/rust-lang/rfcs/blob/master/text/1422-pub-restricted.md
Fixes #970
* Drop #[inline] attribute on format_visibility
* Make newly non-failing functions return String
The change to `format_visibiilty` means that `format_header` and
`format_unit_struct` can no longer fail. Their return type is updated to
reflect that.
2016-05-28 00:58:25 +02:00
Nick Cameron
6e01fac285
Merge pull request #1008 from rust-lang-nursery/hrtb
...
Don't ignore universal quantification in function types
2016-05-28 10:08:00 +12:00
Nick Cameron
0fae34dfa1
Don't ignore universal quantification in function types
...
Fixes #1006
2016-05-27 15:09:04 -07:00
Nick Cameron
d633e831ba
Merge pull request #1009 from rust-lang-nursery/fn-args-1
...
Fix off by 2 error in function sigs
2016-05-28 10:04:04 +12:00
Nick Cameron
882ef8cc82
Fix off by 2 error in function sigs
...
Fixes #1000
This is a little conservative in some cases, but better than being wrong in others.
2016-05-27 15:05:15 -07:00
Nick Cameron
d6bcfceb7e
Don't put a newline before ?
when it is the second sub-expression in a chain ( #1012 )
...
Fixes #1003
2016-05-27 10:33:19 +02:00
Nick Cameron
775de8a62b
Optionally put short struct variants on one line ( #997 )
...
Closes #418
2016-05-18 22:38:49 +02:00
Nick Cameron
9589cac62d
Format inline attributes on out-of-line modules ( #996 )
...
Fixes #838
2016-05-18 22:36:59 +02:00
Nick Cameron
78f8b6c2e3
Merge branch 'master' of github.com:rust-lang-nursery/rustfmt
2016-05-18 10:02:04 +12:00
Nick Cameron
ff3ff5aa87
Handle parser errors better
2016-05-18 09:58:51 +12:00
Nick Cameron
d0720a00a1
Fall back to basic stdout if we can't unwrap a fancy terminal ( #995 )
...
fixes #978
2016-05-17 23:25:57 +02:00
Nick Cameron
c8ba6ee5a2
Merge pull request #992 from srinivasreddy/master
...
change normalise spelling to American version -
2016-05-16 10:15:29 +12:00
Nick Cameron
fcf33fbc2a
Note in te README about compiler version
...
Closes #990
2016-05-16 10:09:53 +12:00
Srinivas Reddy Thatiparthy
952a6beb51
change normalise spelling to American version - normalize as American english is more common across programming community
2016-05-15 22:24:46 +05:30
Nick Cameron
9b05461666
Write each file as it is formatted ( #991 )
...
The old behaviour stored everything in memory until we were finished. Now we write as soon as we can.
This gives better behaviour when formatting large programs, since there is some progress indication. It also opens the door to optimising memory use by not storing everything in memory unless it is required (which it still might be). That is left as future work though.
2016-05-15 11:41:05 +02:00
Nick Cameron
67edc325c6
0.5 release
2016-05-13 12:34:55 -07:00
Nick Cameron
c1949f52e1
Merge pull request #893 from marcusklaas/try-shorthand
...
Try shorthand
2016-05-12 16:07:42 -07:00
Marcus Klaas
eae2921e14
Bootstrap it. Hard.
2016-05-12 21:50:43 +02:00
Marcus Klaas
cd158cecc8
Add try macro to try shorthand conversion tests
2016-05-12 21:15:06 +02:00
Marcus Klaas
ee7b5805fc
Format try shorthand
2016-05-09 20:07:59 +02:00
Nick Cameron
fc2549b576
Merge pull request #981 from DanielJCampbell/generated
...
Altered FmtVisitor to function correctly on generated code
2016-05-06 14:02:56 +12:00
Daniel Campbell
238fc500ae
Altered FmtVisitor to function correctly on generated code
2016-05-06 13:51:48 +12:00
Nick Cameron
b59b0497d3
Merge pull request #980 from DanielJCampbell/visibility
...
Changed modules & visitor mods to public, set filemap::write_file public
2016-05-06 13:09:46 +12:00
Daniel Campbell
4a2db3ec6c
Changed modules & visitor mods to public, set filemap::write_file public
2016-05-06 12:44:18 +12:00
Nick Cameron
635581432f
Merge pull request #979 from kamalmarhubi/update-syntex-syntax
...
deps: Update syntex_syntax to 0.32.0
2016-05-06 08:59:02 +12:00
Kamal Marhubi
8309d1a74c
deps: Update syntex_syntax to 0.32.0
2016-05-05 16:39:34 -04:00
Nick Cameron
47631e2a5c
Merge pull request #974 from sanxiyn/unused-trait-import
...
Remove unused trait imports
2016-05-04 08:32:26 +12:00
Seo Sanghyeon
f85c603c63
Remove unused trait imports
2016-05-03 21:52:55 +09:00
Nick Cameron
15d35a04b4
Merge pull request #973 from habnabit/fix-associated-items
...
Don't misplace the :: on associated items.
2016-05-03 17:22:50 +12:00
Aaron Gallagher
96d59366fc
Don't misplace the :: on associated items.
...
The rewritten location of the :: on global paths for qpaths was wrong.
2016-05-02 17:11:22 -07:00
Nick Cameron
90c0f708f5
Merge pull request #971 from kamalmarhubi/update-syntex-syntax
...
deps: Update syntex_syntax to 0.31.0
2016-05-03 09:19:50 +12:00
Nick Cameron
c696dcf8da
Handle attributes on modules ( #968 )
...
* Handle attributes (including doc comments) on inline modules
Closes #22
Closes #684
* Tweak the rules for changing indentation in comments (to do it less often).
2016-05-02 10:54:25 +02:00
Kamal Marhubi
6285d53885
Handle new visibility types more gracefully
2016-05-02 01:05:23 -04:00
Kamal Marhubi
fd38acb86f
deps: Update syntex_syntax to 0.31.0
...
Most of the churn on this bump comes from the `Visibility` enum changing
from
pub enum Visibility {
Public,
Inherited,
}
to
pub enum Visibility {
Public,
Crate,
Restricted { path: P<Path>, id: NodeId },
Inherited,
}
which require taking `Visibility` by reference in most places. The new
variants are not handled at this point.
Refs #970
2016-05-01 23:06:58 -04:00
Nick Cameron
5092eec081
Merge pull request #966 from MicahChalmer/skip-children-in-plain-write-mode
...
Always skip children when using Plain write mode
2016-04-28 18:15:22 +12:00
Micah Chalmer
70611bf9ac
Always skip children when using Plain write mode
...
Outputting child module contents in the "Plain" write mode does not make
sense, since there is no way to differentiate code that came from a
child module from that which came from the parent file.
2016-04-28 01:44:45 -04:00
Nick Cameron
de2b8d98ea
Merge pull request #960 from rust-lang-nursery/big-closures
...
Block indent large closures and field/method chains
2016-04-28 09:49:08 +12:00
Nick Cameron
fcd2021583
Add visual indent tests for chains
2016-04-28 08:08:54 +12:00
Nick Cameron
9188ec0f7f
Bail out on recovered errors. ( #965 )
...
Closes #915
Closes #930
Closes #931
2016-04-27 21:08:44 +02:00