Commit Graph

361 Commits

Author SHA1 Message Date
jedel1043
e243be6ada Allow formatting Anonymous{Struct, Union} declarations 2021-05-16 22:13:38 -05:00
Joshua Nelson
61ee1089f0 Use rustc_private instead of crates.io dependencies
- Update rust-toolchain to also install `rustc-dev` component
2021-04-21 21:17:36 -05:00
David Bar-On
4b0ed96f2e Fix for issue 4603 about extra macro body indentation (third version) 2021-02-17 20:19:27 -06:00
Sean Klein
5e14f760c5 fix: Avoid incorrect global 'cfg_if' Symbol interning
Fixes #4656
2021-01-27 19:26:58 -06:00
hafiz
c77c6a405d Compare code block line indentation with config whitespace (#4166)
Previously the indetation of a line was compared with the configured
number of spaces per tab, which could cause lines that were formatted
with hard tabs not to be recognized as indented ("\t".len() < "    ".len()).

Closes #4152
2020-11-29 13:26:58 -06:00
Caleb Cartwright
a613c57521 feat: don't insert semi in macro_rules arm body 2020-11-11 18:26:13 -06:00
Caleb Cartwright
ae6b40e2f9 fix: remove ignored depr attribute which now errors 2020-11-05 20:45:11 -06:00
Caleb Cartwright
dead3a807d fix: backport mod resolution error handling 2020-06-11 21:11:18 -05:00
David Tolnay
bc9a0b2974 Switch to std::error::Error for errors (#3948) 2020-06-11 20:23:24 -05:00
Seiichi Uchida
577ef8136f
Update rustc-ap-* crates to 659.0.0 for rustfmt-1.4.15 (#4184) 2020-05-19 17:31:28 +09:00
Caleb Cartwright
b173b42354 refactor: rename libsyntax --> rustc_ast 2020-03-27 22:29:12 -05:00
Caleb Cartwright
bd5dff4012 refactor: backport syntux mod 2020-03-26 21:25:34 -05:00
Caleb Cartwright
c60416ed21 deps: update rustc-ap to v642.0.0 2020-02-08 22:21:37 -06:00
Caleb Cartwright
62432fe31b add new flag to list names of misformatted files (#3747) 2019-08-19 11:04:40 +09:00
Seiichi Uchida
73847d3986
Take the inner macro_use attr into acocunt while reordering (#3749) 2019-08-19 10:56:32 +09:00
Caleb Cartwright
dfd27663dc add json emit mode (#3735) 2019-08-16 11:14:53 +09:00
Seiichi Uchida
c0e616bc1d
Implement closing-block procedure without relying on missed_span module (#3691) 2019-07-17 23:07:12 +09:00
Michele d'Amico
76e2ba25bd #3665: Implemented (#3689) 2019-07-17 09:40:33 +09:00
Seiichi Uchida
1d19a08ed4
Format the last expression-statement as expression (#3631) 2019-06-17 08:53:39 +09:00
Ruben Schmidmeister
dbac28b4b4 Use trait to abstract emit modes (#3616) 2019-06-13 06:59:20 +09:00
Ruben Schmidmeister
8b57668c33
Move macro to separate module 2019-05-17 16:13:46 +02:00
Stéphane Campinas
cc97eaf9f9
Merge pull request #3546 from bash/unreachable-pub
Enable unreachable_pub lint
2019-05-10 09:59:07 +02:00
Ruben Schmidmeister
618d092bf7
Enable unreachable_pub lint 2019-05-09 20:37:51 +02:00
Andy Russell
ee6f686cc9
use derive feature over serde_derive crate 2019-05-09 13:22:44 -04:00
Ruben Schmidmeister
3dc625c661 Use annotate-snippets for emitting errors (#3507) 2019-04-17 05:33:36 -07:00
rChaser53
34bf13718a Allow specifying glob pattern to ignore config option (#3488) 2019-04-14 03:30:44 -07:00
Matthias Krüger
4352681d62 fix clippy warnings
clippy::needless_return
clippy::redundant_closure
clippy::or_fun_call
clippy::len_zero
clippy::expect_fun_call
clippy::assertions_on_constants
clippy::identity_conversion
clippy::chars_last_cmp
2019-04-11 13:48:13 +02:00
rchaser53
1d9104bbae reflect scampi review
- fix README.md
- fix BadAttr doc
- is_rustfmt_macro_error => is_unknown_rustfmt_attr
2019-03-21 21:45:57 +09:00
topecongiro
92f57211c1 Support path-clarity submodule 2019-03-17 12:33:13 +09:00
Igor Matuszewski
b3c28dba83 Expose ModifiedLines and implement parsing data from the string output
This moves `Modified{Chunks,Lines}` from `src/formatting.rs` to
`src/rustfmt_diff.rs` and reexports it in `src/lib.rs`.

With this, a conversion from `Vec<Mismatch>` to `ModifiedLines` was implemented
and now this implements complementary `Display` and `FromStr`, which
simplified the previously used `output_modified` function and which allows to
parse the raw data emitted with `EmitMode::ModifiedLines`.
2019-03-04 18:19:30 +01:00
Igor Matuszewski
0437bf7a7d Allow for stdin input in EmitMode::ModifiedLines 2019-03-04 18:19:30 +01:00
Alexander Regueiro
7a3b7c9275 Various cosmetic improvements (#3403) 2019-02-19 11:56:42 +09:00
Seiichi Uchida
ce682bdabc
Merge pull request #3335 from h-michael/rust-2018
Rust 2018 idioms
2019-02-11 01:12:38 +09:00
Stéphane Campinas
b86dd161df
remove unneeded Version import 2019-02-09 14:23:54 +01:00
Hirokazu Hata
4bb90f5cc8 Fix rust_2018_idioms warnings 2019-02-09 16:14:30 +09:00
Hirokazu Hata
e70e6eb273 deny rust_2018_idioms 2019-02-09 15:55:17 +09:00
Hirokazu Hata
c0f93a6ea3 cargo +nightly fix --edition-idioms 2019-02-09 15:53:12 +09:00
Stéphane Campinas
813aa79567
fix formatting of strings within a macro 2019-02-07 00:05:05 +01:00
Evgenii
ece629b1cc transition to Rust 2018 2019-02-04 13:30:43 +03:00
Mara Bos
24daa174ca Look for a global rustfmt.toml.
If no rustfmt.toml is found in the usual way, the directory 'rustfmt' in
the user's config directory is checked.

 - $XDG_CONFIG_HOME/rustfmt/ (or $HOME/.config/rustfmt/), or
 - $HOME/Library/Preferences/rustfmt/ on Mac, or
 - %AppData%\rustfmt\ on Windows.
2019-01-27 13:22:25 +01:00
wada314
a01990c4d0 Use Unicode-standard char width to wrap comments or strings. (#3275) 2019-01-15 08:41:09 +09:00
Nick Cameron
6739dbe77d
Merge pull request #3129 from otavio/issue-3104
cargo-fmt: detect Rust edition in use
2018-10-25 13:39:40 +13:00
Stéphane Campinas
2f5d864c08
keep track of lines which formatting was disabled in order to prevent indentation which would cause code right-shifting 2018-10-24 12:11:11 +02:00
Otavio Salvador
2eab9714e4 lib: export config::Edition so it can be used externally
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2018-10-23 02:33:36 -03:00
Matthias Krüger
b25f974c0d fix a few typos found via codespell. 2018-10-19 12:28:00 +02:00
Nick Cameron
4bb84f6002 Remove NLL feature
And do some refactoring in comments.rs

Closes #3107
2018-10-18 15:39:11 +13:00
Nick Cameron
613dfcc521 Remove various feature flags 2018-10-18 15:38:57 +13:00
Seiichi Uchida
8c4e92a14e
Catch parser panic in format_snippet (#3103) 2018-10-17 14:21:04 +09:00
Otavio Salvador
e203057db0 utils: rewrite count_newlines using bytecount::count
This uses a optimized byte count and also makes use of SIMD
instructions to optimize the processing of the byte arrays.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2018-10-14 18:27:35 -03:00
Stéphane Campinas
7003276b73
fixed display message for the LineOverflow error 2018-10-11 09:05:33 +02:00