Commit Graph

4939 Commits

Author SHA1 Message Date
Elliot Bobrow
0832137b9e fix link in Contributing.md 2021-07-25 22:53:32 -05:00
Caleb Cartwright
d42be80bf7 chore: disable clippy::matches_like_macro lint 2021-07-25 22:53:32 -05:00
Matthias Krüger
4c2959fb12 fix a bunch of clippy warnings
clippy::bind_instead_of_map
clippy::branches_sharing_code
clippy::collapsible_match
clippy::inconsistent_struct_constructor
clippy::int_plus_one
clippy::iter_count
clippy::iter_nth_zero
clippy::manual_range_contains
clippy::match_like_matches_macro
clippy::needless::collect
clippy::needless_question_mark
clippy::needless_return
clippy::op_ref
clippy::option_as_ref_deref
clippy::ptr_arg
clippy::redundant_clone
clippy::redundant_closure
clippy::redundant_static_lifetimes
clippy::search_is_some
clippy::#single_char_add_str
clippy::single_char_pattern
clippy::single_component_path_imports
clippy::single_match
clippy::skip_while_next
clippy::unnecessary_lazy_evaluations
clippy::unnecessary_unwrap
clippy::useless_conversion
clippy::useless_format
2021-07-25 22:53:32 -05:00
Caleb Cartwright
2cf280ed1b docs: clarify match_arm_blocks config documentation 2021-07-25 22:53:32 -05:00
Jethro Beekman
19733f19f1 Change line endings from CRLF to LF 2021-07-25 22:53:32 -05:00
Caleb Cartwright
b305d62e5b fix: correct arm leading pipe check (#4880)
In the event a pattern starts with a leading pipe
the pattern span will contain, and begin with, the pipe.

This updates the process to see if a match arm contains
a leading pipe by leveraging this recent(ish) change to
the patterns in the AST, and avoids an indexing bug that
occurs when a pattern starts with a non-ascii char in the
old implementation.
2021-07-25 22:53:32 -05:00
Michael Murphy
e634a6f9a8 Updating outdated links (#4869)
* Updating outdated links

Updating the links to the docs and source code for `ast.rs`. Seems like it was moved to a new crate at some point.

* Updating more outdated links

This time, the links to the `fmt-rfcs` repository, which is now owned by
`rust-dev-tools` (although GitHub was redirecting anyway).

* Update Contributing.md

Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>

Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
2021-07-25 22:53:32 -05:00
Michael Murphy
486e774fbf Adjusting help message (#4865)
On stable, running with `--help|-h` shows information about `file-lines`
which is a nightly-only option. This commit removes all mention of
`file-lines` from the help message on stable.

There is room for improvement here; perhaps a new struct called, e.g.,
`StableOptions` could be added to complement the existing
`GetOptsOptions` struct. `StableOptions` could have a field for each
field in `GetOptsOptions`, with each field's value being a `bool` that
specifies whether or not the option exists on stable. Or is this adding
too much complexity?
2021-07-25 22:53:32 -05:00
Casey Rodarmor
1ca3798d2c Improve pasta copyability of merge_imports deprecation message
Add double quotes around `Crate` so that it can be copied directly into a `Cargo.toml` file
2021-07-25 22:53:32 -05:00
Ruby Lazuli
75765f656e Allow --edition 2021 to be passed to rustfmt
This was added to Configurations.md in #4618, but the option wasn't
actually made available. This should let people who are using Rust 2021
on nightly rustc run `cargo fmt` again.
2021-07-25 22:53:32 -05:00
Caleb Cartwright
bfd479d5af
Merge pull request #4920 from calebcartwright/subtree-sync
subtree sync
2021-07-25 19:50:31 -05:00
Camille GILLOT
277feac1f9 Use LocalExpnId where possible. 2021-07-17 19:41:02 +02:00
Guillaume Gomez
abf449ffa6 Rework SESSION_GLOBALS API to prevent overwriting it 2021-07-08 16:16:28 +02:00
Joshua Nelson
33acc960f7 Document rustfmt on nightly-rustc
The recursion_limit attribute avoids the following error:

```
error[E0275]: overflow evaluating the requirement `std::ptr::Unique<rustc_ast::Pat>: std::marker::Send`
  |
  = help: consider adding a `#![recursion_limit="256"]` attribute to your crate (`rustfmt_nightly`)
```
2021-07-01 19:39:47 -04:00
Yuki Okushi
0b8a26f507 Rollup merge of #86424 - calebcartwright:rustfmt-mod-resolution, r=Mark-Simulacrum
rustfmt: load nested out-of-line mods correctly

This should address https://github.com/rust-lang/rustfmt/issues/4874

r? `@Mark-Simulacrum`

Decided to make the change directly in tree here for expediency/to minimize any potential backporting issues, and because there's some subtree sync items I need to get resolved before pulling from r-l/rustfmt
2021-06-22 00:00:41 +09:00
Yuki Okushi
d13020cd31 Rollup merge of #86274 - alexander-melentyev:spaces, r=bjorn3
Spaces
2021-06-22 00:00:38 +09:00
Alexander Melentyev
71f01d1974 Delete spaces 2021-06-21 12:11:37 +03:00
Caleb Cartwright
2608f2c63b fix(rustfmt): load nested out-of-line mods correctly 2021-06-17 22:35:19 -05:00
Yuki Okushi
1e2258ffa9 Use AttrVec for Arm, FieldDef, and Variant 2021-06-17 08:04:54 +09:00
Ryan Levick
58c63cf8de Add support for using qualified paths with structs in expression and pattern
position.
2021-06-10 13:18:41 +02:00
jedel1043
e243be6ada Allow formatting Anonymous{Struct, Union} declarations 2021-05-16 22:13:38 -05:00
Joshua Nelson
d67f1a48ef Update log to 0.4.14
This avoids the following warning:

```
warning: trailing semicolon in macro used in expression position
   --> /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/log-0.4.11/src/macros.rs:152:45
    |
147 | / macro_rules! debug {
148 | |     (target: $target:expr, $($arg:tt)+) => (
149 | |         log!(target: $target, $crate::Level::Debug, $($arg)+);
150 | |     );
151 | |     ($($arg:tt)+) => (
152 | |         log!($crate::Level::Debug, $($arg)+);
    | |                                             ^
153 | |     )
154 | | }
    | |_- in this expansion of `debug!`
    |
   ::: src/tools/rustfmt/src/modules/visitor.rs:36:23
    |
36  |               Err(e) => debug!("{}", e),
    |                         --------------- in this macro invocation
    |
    = note: requested on the command line with `-W semicolon-in-expressions-from-macros`
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813>
```
2021-05-14 21:54:43 -05:00
Caleb Cartwright
7872306edf chore: update gitattributes for files with windows style line endings 2021-05-14 18:50:25 -05:00
Andy Wang
927561ace1 Bump nightly version 2021-05-12 22:12:43 -05:00
Andy Wang
ef31361766 Rename RealFileName::Named to LocalPath 2021-05-12 22:12:43 -05:00
Andy Wang
e4b5621b0e Only deal with LocalPath in conversion 2021-05-12 22:12:43 -05:00
Andy Wang
8526acee21 Rename span_to_string to span_to_diagnostic_string 2021-05-12 22:12:43 -05:00
Caleb Cartwright
2a3635d5d1 tests: remove snippets with inner attrs on non-block expressions 2021-05-04 18:38:22 -05:00
Caleb Cartwright
f87414729f fix: backport changes for latest rustc api comaptibility 2021-05-02 10:37:43 -05:00
Yuki Okushi
ddb224a173
Upgrade annotate-snippets to 0.8 (#4762) 2021-04-22 08:33:36 -05:00
ChinYing-Li
84ff0013c2 Add the case in duplicate issue (#4806) to the idempotent tests 2021-04-21 21:30:42 -05:00
ChinYing-Li
dac2423f3f Recognize when a block comment has been ended inside a string literal (#4312) 2021-04-21 21:30:42 -05:00
Joseph Birr-Pixton
58157bb4b7 Add some basic tests for chain_width use 2021-04-21 21:27:50 -05:00
Caleb Cartwright
78b0728887 refactor: remove panics on misconfigured widths 2021-04-21 21:27:50 -05:00
Caleb Cartwright
a168d92f9a tests: augment heuristics tests 2021-04-21 21:27:50 -05:00
Caleb Cartwright
1bcc1f8df5 refactor: apply heuristic config changes in lib 2021-04-21 21:27:50 -05:00
Caleb Cartwright
ea1611c06e feat(config): expose all width heurstic options 2021-04-21 21:27:50 -05:00
Caleb Cartwright
0269eb1c5f docs: update configuration info 2021-04-21 21:27:50 -05:00
Joshua Nelson
26fb3fa737 Use rustup in CI to automatically determine the toolchain version needed
This also removes the (now unused) `RUSTC_RELEASE` and
`RUSTC_RELEASE_CHANNEL` variables.
2021-04-21 21:17:36 -05:00
Joshua Nelson
943b97c3ae Fix errors when parallel_compiler is enabled 2021-04-21 21:17:36 -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
Joshua Nelson
6767c1d051 Don't show CRLF tests as modified in the working directory
This was being overriden by `lf=eof` in `.gitattributes` in the root
directory. Override it again to avoid warnings like this:

```
$ git diff src/tools/rustfmt/tests/target/issue-3494/crlf.rs
warning: CRLF will be replaced by LF in src/tools/rustfmt/tests/target/issue-3494/crlf.rs.
The file will have its original line endings in your working directory
```
2021-04-21 21:17:36 -05:00
Caleb Cartwright
0bd2b1927c chore: bump version and changelog 2021-04-03 00:30:12 -05:00
Caleb Cartwright
01cdc15f13 chore: bump toolchain 2021-04-02 23:21:06 -05:00
Caleb Cartwright
c32f2ec015 chore: fmt and cleanup 2021-04-02 23:21:06 -05:00
Caleb Cartwright
4948911608 deps: apply rustc-ap-* v712 changes 2021-04-02 23:21:06 -05:00
Caleb Cartwright
ef57c5bf67 chore: bump rustc-ap crates to v712 2021-04-02 23:21:06 -05:00
Caleb Cartwright
748e595047 deps: remove unused rustc_attr crate AP crate 2021-04-02 23:21:06 -05:00
Caleb Cartwright
bf1e47f78d chore: bump toolchain 2021-04-02 23:21:06 -05:00
Caleb Cartwright
884cdb8ad1 deps: bump rustc-ap crates to v711 2021-04-02 23:21:06 -05:00