Sergey Pepyakin
f6959a4772
Fix issue-1116
2016-08-04 08:54:40 +03:00
Julien Blanchard
b4e49ddbf5
Fix imports with absolute paths
2016-08-01 10:10:04 +02:00
Stuart Dootson
78b52ec3e1
Add use
declaration re-ordering ( #1104 )
...
* Add config options for combinations of lines and items
* Reordering of import lines implemented.
* Changed nested matches to tuple pattern matching
* Added ordering of path list items to the ordering of use declarations
* Move `format_imports` and `format_import` methods to `imports.rs`
* Add comment to explain how `use` declarations are split off while walking through a module
* Change `ImportReordering` config option to separate boolean options
2016-07-26 17:20:01 +12: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
Marcus Klaas
98c0570a28
Format non-statement if-else expressions on a single line
2016-05-29 17:58:38 +02:00
Nick Cameron
da65090050
Merge pull request #857 from kamalmarhubi/codemap-ext
...
utils: Add CodeMapExt extension trait for span_* methods
2016-03-14 18:00:51 +13:00
Kamal Marhubi
d82d9fc808
utils: Add CodeMapSpanUtils trait for span_* methods
...
This commit adds a CodeMapSpanUtils extension trait on CodeMap, and
moves some functions to methods there:
- span_after
- span_after_last
- span_before
This better reflects them being lookup methods on the codemap.
2016-03-13 18:14:07 -04:00
Kamal Marhubi
589dabda2f
deps: Update syntex_syntax to 0.29.1
2016-03-02 13:08:21 -05:00
Nick Cameron
d86cfb357a
Format all patterns (well, except macros)
...
Fixes #18
Fixes #672
2016-02-12 14:59:13 +13:00
Marcus Klaas
6e1f77664d
Unwrap match arms that are simple blocks
2015-11-20 21:05:18 +01:00
Eli Friedman
2fff041b43
Pass in whether an ast::Path is in an expression context.
...
This gets rid of a slightly nasty hack involving scanning the source
expression for a ":".
2015-11-14 13:54:57 -08:00
Marcus Klaas
199d40fa55
Increase default function call width limit
2015-10-06 22:27:11 +02:00
Marcus Klaas
a76df6b4d9
Make listItem contain option
2015-10-04 20:40:14 +02:00
Marcus Klaas
965ea09664
Split ListTactic decision logic from write_list
2015-10-04 20:40:14 +02:00
Marcus Klaas
431e8d9d2f
Remove a few unchecked subtractions, uses of ty_to_string
2015-09-27 17:56:38 +02:00
Nick Cameron
b2e7da0aa0
Format imports with aliases.
...
Closes #366
2015-09-26 18:12:25 +12:00
Pavel Sountsov
d4108a3029
Initial implementation of hard tab indentation.
2015-09-19 10:36:45 -07:00
Marcus Klaas
7f576b0602
General cleanup after rebase
2015-09-11 00:53:21 +02:00
Marcus Klaas
659c9b9037
Update indentation heuristics for single arg functions
2015-09-11 00:52:20 +02:00
Marcus Klaas
d05a41c773
Add failure mode to write_list
2015-09-07 20:35:25 +02:00
Ivan Apachev
c7e6d0b54a
Replace uses of x.len() == 0 by x.is_empty() #187
2015-08-25 01:07:48 +03:00
Marcus Klaas
5fcd313b08
Format closures
2015-08-19 23:15:56 +02:00
Nick Cameron
a43e2b5ae8
Formatting
2015-08-20 08:11:14 +12:00
Marcus Klaas
4e0a8da447
Refactor itemize list so that it produces an iterator
2015-08-19 18:40:02 +02:00
Marcus Klaas
41bca58100
Format paths
2015-08-16 22:53:06 +02:00
Marcus Klaas
54a96355dd
Phase out token::get_ident in favour of ToString
...
token::get_ident was removed in rust commit 00a5e66f818ad9d79cc4425f5564c7b07e3213a6
2015-07-31 13:10:19 +02:00
Marcus Klaas
397d0d3d72
Format simple imports
2015-07-25 23:17:56 +02:00
cassiersg
5168d7458a
Indent fix
2015-07-25 19:00:38 +02:00
Gaëtan Cassiers
30b16bc474
Move 'use' to Rewrite
...
Implements Rewrite for ViewPath
Behavior change: always use max_width instead of ideal_width for use
list rewrite. I think it looks better, was also suggested by @nrc in
https://github.com/nrc/rustfmt/issues/82#issuecomment-105314265
2015-07-25 19:00:38 +02:00
Marcus Klaas
c4101de53d
Refactor some things; add extra tests.
2015-07-24 19:00:14 +02:00
Marcus Klaas
b161815fe0
Format if-else expressions
2015-07-19 23:42:54 +02:00
Nick Cameron
979d0c9756
Resolve some warnings
2015-07-17 18:26:10 +12:00
Nick Cameron
018fa85453
Reformat code to new struct lit style
2015-07-16 14:05:10 +12:00
Gaëtan Cassiers
990a123e1c
Run rustfmt on the code
2015-07-03 11:13:28 +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
28f7bd4205
Fixup comment wrapping in lists
2015-06-24 21:14:08 +02:00
Marcus Klaas
0ef5db9496
Format tuple-like structs
2015-06-23 16:54:42 +02:00
Nick Cameron
1488d5eadb
Merge pull request #90 from marcusklaas/empty-imports
...
Remove empty list imports
2015-06-22 17:32:55 -07:00
Marcus Klaas
27d6558964
Remove empty list imports
2015-06-02 23:55:16 +02:00
Marcus Klaas
90bc40a111
Implement basic enum formatting
2015-06-02 15:52:07 +02:00
Nick Cameron
46818d405a
Struct literals
2015-05-25 19:14:20 +12:00
Nick Cameron
3b383a4c22
Merge branch 'single-import' of https://github.com/mattyhall/rustfmt into mattyhall-single-import
...
Rebased:
src/imports.rs
2015-05-12 10:03:25 +12:00
Marcus Klaas
c790d7d550
Keep import lists on a single line when possible
2015-05-04 22:22:31 +02:00
Marcus Klaas
58a14fbc79
Correctly indent use items and functions
2015-05-04 09:25:20 +02:00
Matthew Hall
59352172b3
Change import lists with one item to single import
...
Changes lists such as ``use std::{fmt}`` to a form without a list, eg
``use std::fmt``.
2015-05-02 20:28:38 +01:00
Nick Cameron
0931b7c6df
Merge pull request #45 from tbu-/pr_toowned
...
Change `to_string` to `to_owned` when it just creates a `String` from a `&str`
2015-04-30 21:10:54 +12:00
Tobias Bucher
5247d98d31
Change to_string
to to_owned
when it just creates a String
from a &str
...
This means that it doesn't have to go through the formatting hierarchy and can
just immediately reserve enough memory.
2015-04-30 10:31:42 +02:00
Manish Goregaokar
9398aed82c
Handle pub use ( fixes #23 )
2015-04-30 13:52:28 +05:30
Nick Cameron
cdfda8801e
Absolute paths
2015-04-28 21:36:31 +12:00
Nick Cameron
9070a055de
Comments after return
2015-04-28 21:24:56 +12:00