]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agofallback to dir_path when relative external mod resolution fails
Yacin Tmimi [Sun, 30 Jan 2022 18:46:53 +0000 (13:46 -0500)]
fallback to dir_path when relative external mod resolution fails

We only want to fall back if two conditions are met:

1) Initial module resolution is performed relative to some nested
   directory.
2) Module resolution fails because of a ModError::FileNotFound error.

When these conditions are met we can try to fallback to searching for
the module's file relative to the dir_path instead of the nested
relative directory.

Fixes 5198

As demonstrated by 5198, it's possible that a directory name conflicts
with a rust file name. For example, src/lib/ and src/lib.rs.

If src/lib.rs references an external module like ``mod foo;``, then
module resolution will try to resolve ``foo`` to src/lib/foo.rs or
src/lib/foo/mod.rs. Module resolution would fail with a file not
found error if the ``foo`` module were defined at src/foo.rs.

When encountering these kinds of module resolution issues we now fall
back to the current directory and attempt to resolve the module again.

Given the current example, this means that if we can't find the module
``foo`` at src/lib/foo.rs or src/lib/foo/mod.rs, we'll attempt
to resolve the module to src/foo.rs.

2 years agofix: unused test imports on non-nightly, prevent regression
Caleb Cartwright [Thu, 24 Feb 2022 03:37:42 +0000 (21:37 -0600)]
fix: unused test imports on non-nightly, prevent regression

2 years agofix: formatting in new test
Caleb Cartwright [Wed, 16 Feb 2022 02:49:36 +0000 (20:49 -0600)]
fix: formatting in new test

2 years agoUse cargo-fmt in self_tests
Cameron Steffen [Tue, 1 Feb 2022 19:39:01 +0000 (13:39 -0600)]
Use cargo-fmt in self_tests

2 years agoFormat code
Cameron Steffen [Tue, 1 Feb 2022 19:38:54 +0000 (13:38 -0600)]
Format code

2 years agoAdd context to get_toml_path() error (#5207)
Travis Finkenauer [Tue, 15 Feb 2022 23:25:44 +0000 (15:25 -0800)]
Add context to get_toml_path() error (#5207)

* rustfmt: print full error chain

* Add context to get_toml_path() error

Instead of an error like:

```
Permission denied (os error 13)
```

Gives error like:

```
Failed to get metadata for config file "/root/.rustfmt.toml": Permission denied (os error 13)
```

2 years agoLeverage itemized blocks to support formatting markdown block quotes
Yacin Tmimi [Thu, 30 Dec 2021 00:59:54 +0000 (19:59 -0500)]
Leverage itemized blocks to support formatting markdown block quotes

Fixes 5157

Doc comments support markdown, but rustfmt didn't previously assign any
semantic value to leading '> ' in comments. This lead to poor formatting
when using ``wrap_comments=true``.

Now, rustfmt treats block quotes as itemized blocks, which greatly
improves how block quotes are formatted when ``wrap_comments=true``.

2 years agochore(rustfmt): remove executable path from usage string (#5216)
Tharun Rajendran [Fri, 11 Feb 2022 04:35:45 +0000 (10:05 +0530)]
chore(rustfmt): remove executable path from usage string (#5216)

* chore(rustfmt): remove executable path from usage string

* add unit test for usage string

* rename test and check usage text in a single assert

2 years agoClarify generated marker requires a config option
Stepan Koltsov [Mon, 7 Feb 2022 04:39:53 +0000 (04:39 +0000)]
Clarify generated marker requires a config option

2 years agoFix incorrect string indentation in macro defs with `format_strings`
Gabriel Smith [Sat, 29 Jan 2022 21:44:49 +0000 (16:44 -0500)]
Fix incorrect string indentation in macro defs with `format_strings`

2 years agoFix doc of generic items formmating error (#5124)
Frank King [Mon, 7 Feb 2022 02:57:39 +0000 (10:57 +0800)]
Fix doc of generic items formmating error (#5124)

* Fix doc of generic items formmating error

* Remove tracked `attrs_end_with_doc_comment` flag in `RewriteContext`

* Fix duplicated doc comments of const generic params

* Fix `<ast::GenericParam as Spanned>::span()`

* Remove duplicated source file of `doc-of-generic-item.rs`

2 years agoAdd tests for the One and Crate variants
Stéphane Campinas [Wed, 2 Feb 2022 14:43:31 +0000 (15:43 +0100)]
Add tests for the One and Crate variants

2 years agoFix import_granularity option when the use tree has an alias
Stéphane Campinas [Mon, 31 Jan 2022 22:45:30 +0000 (23:45 +0100)]
Fix import_granularity option when the use tree has an alias

2 years agoRetain trailing separator when extracting the last inline post comment
Yacin Tmimi [Sun, 19 Dec 2021 21:47:13 +0000 (16:47 -0500)]
Retain trailing separator when extracting the last inline post comment

Fixes 5042

Previously, trailing commas were removed from the last inline comment.
This lead to rustfmt refusing to format code snippets because
the original comment did not match the rewritten comment.

Now, when rustfmt extracts the last inline comment it leaves trailing
separators alone. Rustfmt does not need to remove these separators
because they are commented out.

2 years agoHandle non-ascii character at boundary (#5089)
Stéphane Campinas [Wed, 2 Feb 2022 01:06:14 +0000 (02:06 +0100)]
Handle non-ascii character at boundary (#5089)

* Handle non-ascii character at boundary

* Replace substraction underflow check with early termination

2 years agoPrevent adding trailing whitespace when rewriting ast::Param
Yacin Tmimi [Fri, 10 Dec 2021 04:17:43 +0000 (23:17 -0500)]
Prevent adding trailing whitespace when rewriting ast::Param

Fixes 5125

Previously, a newline was always added, even if the parameter name was
not preceded by any param attrs.

Now a newline is only added if there were param attrs.

2 years agoFix formatting of comments in empty structs (#5171)
Szymon Gibała [Sat, 29 Jan 2022 04:55:47 +0000 (05:55 +0100)]
Fix formatting of comments in empty structs (#5171)

* Fix formatting of comments in empty structs

* Add tests

* Add single line tests

* Fix block comments

* Revert changes of test source files

2 years agoMerge pull request #5186 from calebcartwright/subtree-sync-2022-01-23
Caleb Cartwright [Sun, 23 Jan 2022 18:35:18 +0000 (12:35 -0600)]
Merge pull request #5186 from calebcartwright/subtree-sync-2022-01-23

sync subtree

2 years agochore: bump toolchain, update test
Caleb Cartwright [Sun, 23 Jan 2022 17:18:17 +0000 (11:18 -0600)]
chore: bump toolchain, update test

2 years agoMerge remote-tracking branch 'upstream/master' into subtree-sync-2022-01-23
Caleb Cartwright [Sun, 23 Jan 2022 17:07:20 +0000 (11:07 -0600)]
Merge remote-tracking branch 'upstream/master' into subtree-sync-2022-01-23

2 years agoAdd term to ExistentialProjection
kadmin [Thu, 13 Jan 2022 07:39:58 +0000 (07:39 +0000)]
Add term to ExistentialProjection

Also prevent ICE when adding a const in associated const equality.

2 years agoAdd term
kadmin [Fri, 7 Jan 2022 03:58:32 +0000 (03:58 +0000)]
Add term

Instead of having a separate enum variant for types and consts have one but have either a const
or type.

2 years agoadd eq constraints on associated constants
kadmin [Fri, 30 Jul 2021 08:56:45 +0000 (08:56 +0000)]
add eq constraints on associated constants

2 years agoAuto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieu
bors [Mon, 17 Jan 2022 09:40:29 +0000 (09:40 +0000)]
Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieu

Remove deprecated LLVM-style inline assembly

The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove
it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it
is time to remove `llvm_asm!` to avoid continued maintenance cost.

Closes #70173.
Closes #92794.
Closes #87612.
Closes #82065.

cc `@rust-lang/wg-inline-asm`

r? `@Amanieu`

2 years agofix(rustfmt): resolve generated file formatting issue
Caleb Cartwright [Sat, 15 Jan 2022 00:18:37 +0000 (18:18 -0600)]
fix(rustfmt): resolve generated file formatting issue

2 years agoRemove LLVM-style inline assembly from rustfmt
Tomasz Miąsko [Wed, 12 Jan 2022 00:00:00 +0000 (00:00 +0000)]
Remove LLVM-style inline assembly from rustfmt

2 years agoCompute most of Public/Exported access level in rustc_resolve
Lamb [Mon, 26 Jul 2021 03:38:16 +0000 (05:38 +0200)]
Compute most of Public/Exported access level in rustc_resolve

Mak DefId to AccessLevel map in resolve for export

hir_id to accesslevel in resolve and applied in privacy
using local def id
removing tracing probes
making function not recursive and adding comments

Move most of Exported/Public res to rustc_resolve

moving public/export res to resolve

fix missing stability attributes in core, std and alloc

move code to access_levels.rs

return for some kinds instead of going through them

Export correctness, macro changes, comments

add comment for import binding

add comment for import binding

renmae to access level visitor, remove comments, move fn as closure, remove new_key

fmt

fix rebase

fix rebase

fmt

fmt

fix: move macro def to rustc_resolve

fix: reachable AccessLevel for enum variants

fmt

fix: missing stability attributes for other architectures

allow unreachable pub in rustfmt

fix: missing impl access level + renaming export to reexport

Missing impl access level was found thanks to a test in clippy

2 years agosome minor clippy fixes
Matthias Krüger [Wed, 5 Jan 2022 20:19:36 +0000 (21:19 +0100)]
some minor clippy fixes

2 years agoUse <stdin> when emitting stdin as filename (#4298)
Seiichi Uchida [Fri, 3 Jul 2020 02:13:16 +0000 (11:13 +0900)]
Use <stdin> when emitting stdin as filename (#4298)

# Conflicts:
# src/config/file_lines.rs
# src/rustfmt/main.rs
# src/test/mod.rs

2 years agoFix newlines in JSON output (#4262)
Tim [Tue, 23 Jun 2020 00:20:29 +0000 (01:20 +0100)]
Fix newlines in JSON output (#4262)

* Fix newlines in JSON output

This changes the JSON output to be more consistent about where newlines are included. Previously it only included them between lines in a multiline diff. That meant single line changes were treated a bit weirdly. This changes it to append a newline to every line.

When feeding the results into `arc lint` this behaves correctly. I have only done limited testing though, in particular there's a possibility it might not work with files with `\r\n` endings (though that would have been the case before too).

Fixes #4259

* Update tests
# Conflicts:
# tests/writemode/target/output.json

2 years agorefactor: update json emitter to better handle errors (#3953)
Caleb Cartwright [Mon, 9 Dec 2019 10:41:16 +0000 (04:41 -0600)]
refactor: update json emitter to better handle errors (#3953)

2 years agoFix --check -l with stdin. (#3910)
Chris Emerson [Tue, 12 Nov 2019 02:55:04 +0000 (02:55 +0000)]
Fix --check -l with stdin. (#3910)

* Fix some possible panics when using `--check` with stdin.

One case which doesn't work is when there are only line ending fixes;
with stdin rustfmt is unable to detect the difference as it stores
the input with Unix line endings.

* Add test for `rustfmt --check -l` with stdin.

2 years agoMake `--check` work when running from stdin. (#3896)
Chris Emerson [Wed, 6 Nov 2019 10:15:34 +0000 (10:15 +0000)]
Make `--check` work when running from stdin. (#3896)

# Conflicts:
# src/bin/main.rs

2 years agoImprove out of line module resolution
Yacin Tmimi [Mon, 20 Dec 2021 02:27:25 +0000 (21:27 -0500)]
Improve out of line module resolution

Fixes 5119

When the directory structure was laid out as follows:

```
dir
 |---mod_a
 |    |---sub_mod_1.rs
 |    |---sub_mod_2.rs
 |---mod_a.rs
```

And ``mod_a.rs`` contains the following content:

```rust
mod mod_a {
    mod sub_mod_1;
    mod sub_mod_2;
}
```

rustfmt previously tried to find ``sub_mod_1.rs`` and ``sub_mod_2.rs``
in ``./mod_a/mod_a/``. This directory does not exist and this caused
rustfmt to fail with the error message:

    Error writing files: failed to resolve mod

Now, both ``sub_mod_1.rs`` and ``sub_mod_2.rs`` are resolved correctly
and found at ``mod_a/sub_mod_1.rs`` and ``mod_a/sub_mod_2.rs``.

2 years agoMerge commit '4a053f206fd6799a25823c307f7d7f9d897be118' into sync-rustfmt-subtree
Caleb Cartwright [Thu, 30 Dec 2021 02:49:39 +0000 (20:49 -0600)]
Merge commit '4a053f206fd6799a25823c307f7d7f9d897be118' into sync-rustfmt-subtree

2 years agoDo not flatten match arm block with leading attributes
David Lattimore [Wed, 29 Dec 2021 23:13:45 +0000 (10:13 +1100)]
Do not flatten match arm block with leading attributes

This is a backport of #4124.

Fixes #4109

2 years agofeat: support parsing asm! args
Caleb Cartwright [Wed, 29 Dec 2021 01:23:51 +0000 (19:23 -0600)]
feat: support parsing asm! args

2 years agochore: bump toolchain
Caleb Cartwright [Wed, 29 Dec 2021 01:23:31 +0000 (19:23 -0600)]
chore: bump toolchain

2 years agochore: reduce some vis. for updated unreachable_pub lint
Caleb Cartwright [Mon, 27 Dec 2021 23:42:48 +0000 (17:42 -0600)]
chore: reduce some vis. for updated unreachable_pub lint

2 years agoRetain qualified path when rewriting struct literals
Yacin Tmimi [Fri, 24 Dec 2021 01:22:09 +0000 (20:22 -0500)]
Retain qualified path when rewriting struct literals

Fixes 5151

Details about the qualified path are now passed along so that rustfmt
can include them when formatting struct literals.

2 years agoFix static async closure qualifier order
David Tolnay [Thu, 23 Dec 2021 22:23:51 +0000 (14:23 -0800)]
Fix static async closure qualifier order

2 years agochore: cleanup unused imports
Caleb Cartwright [Tue, 21 Dec 2021 02:33:20 +0000 (20:33 -0600)]
chore: cleanup unused imports

2 years agorefactor: encapsulate cfg_if parsing within parse mod
Caleb Cartwright [Tue, 21 Dec 2021 02:28:55 +0000 (20:28 -0600)]
refactor: encapsulate cfg_if parsing within parse mod

2 years agorefactor: extract final rustc_parse touchpoint from macros.rs
Caleb Cartwright [Tue, 21 Dec 2021 01:44:23 +0000 (19:44 -0600)]
refactor: extract final rustc_parse touchpoint from macros.rs

2 years agorefactor: move lazy_static parsing to parse mod
Caleb Cartwright [Tue, 21 Dec 2021 01:38:00 +0000 (19:38 -0600)]
refactor: move lazy_static parsing to parse mod

2 years agorefactor: move macro arg parsing to parse mod
Caleb Cartwright [Tue, 21 Dec 2021 00:59:01 +0000 (18:59 -0600)]
refactor: move macro arg parsing to parse mod

2 years agorefactor: rename syntux mod to parse
Caleb Cartwright [Mon, 20 Dec 2021 23:55:48 +0000 (17:55 -0600)]
refactor: rename syntux mod to parse

2 years agoMerge pull request #5140 from calebcartwright/subtree-sync-2021-12-19
Caleb Cartwright [Mon, 20 Dec 2021 22:40:50 +0000 (16:40 -0600)]
Merge pull request #5140 from calebcartwright/subtree-sync-2021-12-19

Subtree sync

2 years agochore: bump toolchain
Caleb Cartwright [Mon, 20 Dec 2021 17:58:27 +0000 (11:58 -0600)]
chore: bump toolchain

2 years agoMerge remote-tracking branch 'upstream/master' into subtree-sync-2021-12-19
Caleb Cartwright [Sun, 19 Dec 2021 21:22:45 +0000 (15:22 -0600)]
Merge remote-tracking branch 'upstream/master' into subtree-sync-2021-12-19

2 years agoRemove unnecessary sigils around `Ident::as_str()` calls.
Nicholas Nethercote [Wed, 15 Dec 2021 05:13:11 +0000 (16:13 +1100)]
Remove unnecessary sigils around `Ident::as_str()` calls.

2 years agoRemove unnecessary sigils around `Symbol::as_str()` calls.
Nicholas Nethercote [Wed, 15 Dec 2021 03:39:23 +0000 (14:39 +1100)]
Remove unnecessary sigils around `Symbol::as_str()` calls.

2 years agoRemove `SymbolStr`.
Nicholas Nethercote [Tue, 14 Dec 2021 21:32:21 +0000 (08:32 +1100)]
Remove `SymbolStr`.

By changing `as_str()` to take `&self` instead of `self`, we can just
return `&str`. We're still lying about lifetimes, but it's a smaller lie
than before, where `SymbolStr` contained a (fake) `&'static str`!

2 years agoPrevent duplicate comma when formatting struct pattern with ".."
Yacin Tmimi [Thu, 18 Nov 2021 01:46:48 +0000 (20:46 -0500)]
Prevent duplicate comma when formatting struct pattern with ".."

Fixes 5066

When a struct pattern that contained a ".." was formatted, it was
assumed that a trailing comma should always be added if the struct
fields weren't formatted vertically.

Now, a trailing comma is only added if not already included in the
reformatted struct fields.

2 years agoclippy fixes
Matthias Krüger [Sun, 12 Dec 2021 19:15:08 +0000 (20:15 +0100)]
clippy fixes

2 years agoBackport: Do not touch module with #![rustfmt::skip] (4297)
Yacin Tmimi [Wed, 24 Nov 2021 23:47:37 +0000 (18:47 -0500)]
Backport: Do not touch module with #![rustfmt::skip] (4297)

Although the implementation is slightly different than the original PR,
the general idea is the same. After collecting all modules we want to
exclude formatting those that contain the #![rustfmt::skip] attribute.

2 years agoMerge commit '8da837185714cefbb261e93e9846afb11c1dc60e' into sync-rustfmt-subtree
Caleb Cartwright [Fri, 3 Dec 2021 03:35:30 +0000 (21:35 -0600)]
Merge commit '8da837185714cefbb261e93e9846afb11c1dc60e' into sync-rustfmt-subtree

2 years agoMerge pull request #5121 from calebcartwright/subtree-sync-2021-12-02
Caleb Cartwright [Fri, 3 Dec 2021 03:29:47 +0000 (21:29 -0600)]
Merge pull request #5121 from calebcartwright/subtree-sync-2021-12-02

subtree sync

2 years agoMerge remote-tracking branch 'upstream/master' into subtree-sync-2021-12-02
Caleb Cartwright [Fri, 3 Dec 2021 03:02:14 +0000 (21:02 -0600)]
Merge remote-tracking branch 'upstream/master' into subtree-sync-2021-12-02

2 years agoDetermine when new comment lines are needed for itemized blocks
Yacin Tmimi [Fri, 19 Nov 2021 23:52:52 +0000 (18:52 -0500)]
Determine when new comment lines are needed for itemized blocks

Fixes 5088

Previously, rustfmt would add a new comment line anytime it reformatted
an itemized block within a comment when ``wrap_comments=true``. This
would lead to rustfmt adding empty comments with trailing whitespace.

Now, new comment lines are only added if the original comment spanned
multiple lines, if the comment needs to be wrapped, or if the comment
originally started with an empty comment line.

2 years agoUpdate nightly only test with #[nightly_only_test] attribute
Yacin Tmimi [Mon, 29 Nov 2021 04:39:31 +0000 (23:39 -0500)]
Update nightly only test with #[nightly_only_test] attribute

2 years agorefactor: maintain more AST info when formatting a RHS
Caleb Cartwright [Sun, 28 Nov 2021 21:22:49 +0000 (15:22 -0600)]
refactor: maintain more AST info when formatting a RHS

2 years agoConditionally compile tests based on CFG_RELEASE_CHANNEL env var
Yacin Tmimi [Sat, 27 Nov 2021 22:14:15 +0000 (17:14 -0500)]
Conditionally compile tests based on CFG_RELEASE_CHANNEL env var

Adds the ``nightly_only_test`` and ``stable_only_test`` attribute macros
that prevent or allow certain tests to compile on nightly and stable
respectively. This is achieved through conditionally outputting the
tests TokenStream.

If CFG_RELEASE_CHANNEL is not set, it's assumed that we're running in a
nightly environment.

To mark a test as nightly only:

    #[nightly_only_test]
    #[test]
    fn only_run_on_nightly() {
        ...
    }

To mark a test a stable only:

    #[stable_only_test]
    #[test]
    fn only_run_on_stable() {
        ...
    }

2 years agoRun Windows, Linux, and Mac CI tests with nightly and stable channels
Yacin Tmimi [Wed, 24 Nov 2021 08:35:01 +0000 (03:35 -0500)]
Run Windows, Linux, and Mac CI tests with nightly and stable channels

2 years agoAdd more tests for comments in lists
mujpao [Wed, 24 Nov 2021 23:05:23 +0000 (15:05 -0800)]
Add more tests for comments in lists

2 years agoUpdate README.md
Fabian Keller [Wed, 24 Nov 2021 09:38:55 +0000 (10:38 +0100)]
Update README.md

2 years agoChange how the fn params span is calculated
Esteban Kuber [Wed, 24 Nov 2021 17:11:15 +0000 (17:11 +0000)]
Change how the fn params span is calculated

Use the available Generics span field to avoid issues with `T: Fn()` bounds.

This is necessary to land #85346.

2 years agofix: do not wrap reference-style doc links
Dom [Fri, 19 Nov 2021 19:15:33 +0000 (20:15 +0100)]
fix: do not wrap reference-style doc links

Prevents wrap_comments from incorrectly wrapping reference-style doc
links.

2 years agoAdd a few missing tracking issues in Configurations.md (#5084)
Johannes Linke [Sat, 20 Nov 2021 01:22:50 +0000 (02:22 +0100)]
Add a few missing tracking issues in Configurations.md (#5084)

* Add a few missing tracking issues in Configurations.md

* fix: tracking issue for imports_granularity stabilization

Co-authored-by: Caleb Cartwright <calebcartwright@users.noreply.github.com>
2 years agoPreserve normalized comments after last list item
mujpao [Fri, 19 Nov 2021 01:06:49 +0000 (17:06 -0800)]
Preserve normalized comments after last list item

2 years agofix: correct some type alias issues
Caleb Cartwright [Thu, 18 Nov 2021 18:39:38 +0000 (12:39 -0600)]
fix: correct some type alias issues

2 years agotests: add cases for type alias issues
Caleb Cartwright [Thu, 18 Nov 2021 18:38:34 +0000 (12:38 -0600)]
tests: add cases for type alias issues

2 years agorefactor: cleanup duplicative Impl handling code
Caleb Cartwright [Wed, 17 Nov 2021 18:51:37 +0000 (12:51 -0600)]
refactor: cleanup duplicative Impl handling code

2 years agoLink tracking issues in Configurations.md (#4096)
Wu Yu Wei [Tue, 31 Mar 2020 06:36:12 +0000 (14:36 +0800)]
Link tracking issues in Configurations.md (#4096)

# Conflicts:
# Configurations.md

2 years agoMerge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-sync
Caleb Cartwright [Mon, 8 Nov 2021 02:37:34 +0000 (20:37 -0600)]
Merge commit 'ea199bacef07213dbe008841b89c450e3bf0c638' into rustfmt-sync

2 years agoMerge pull request #5070 from calebcartwright/rustup-2021-11-s1
Caleb Cartwright [Mon, 8 Nov 2021 01:40:15 +0000 (19:40 -0600)]
Merge pull request #5070 from calebcartwright/rustup-2021-11-s1

subtree sync

2 years agochore: bump toolchain
Caleb Cartwright [Mon, 8 Nov 2021 01:06:24 +0000 (19:06 -0600)]
chore: bump toolchain

2 years agoMerge remote-tracking branch 'upstream/master' into rustup-2021-11-s1
Caleb Cartwright [Sun, 7 Nov 2021 20:44:33 +0000 (14:44 -0600)]
Merge remote-tracking branch 'upstream/master' into rustup-2021-11-s1

2 years agorefactor: dedupe associated item visitation
Caleb Cartwright [Sat, 6 Nov 2021 22:12:25 +0000 (17:12 -0500)]
refactor: dedupe associated item visitation

2 years agoast: Fix naming conventions in AST structures
Vadim Petrochenkov [Sun, 7 Nov 2021 08:43:49 +0000 (16:43 +0800)]
ast: Fix naming conventions in AST structures

TraitKind -> Trait
TyAliasKind -> TyAlias
ImplKind -> Impl
FnKind -> Fn

All `*Kind`s in AST are supposed to be enums.

Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order.

Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.

2 years agorefactor: dedupe & simplify ty alias formatting
Caleb Cartwright [Sat, 6 Nov 2021 17:59:06 +0000 (12:59 -0500)]
refactor: dedupe & simplify ty alias formatting

2 years agoPut empty trait braces on same line if possible
mujpao [Tue, 2 Nov 2021 06:13:30 +0000 (23:13 -0700)]
Put empty trait braces on same line if possible

2 years agoUpdate IntelliJ Integration (#4238)
Dmitry Murzin [Sat, 6 Jun 2020 14:19:50 +0000 (17:19 +0300)]
Update IntelliJ Integration (#4238)

2 years agofix: handle external mods imported via external->inline load hierarchy
Caleb Cartwright [Thu, 4 Nov 2021 23:00:22 +0000 (18:00 -0500)]
fix: handle external mods imported via external->inline load hierarchy

2 years agoci: drop appveyor
Caleb Cartwright [Thu, 4 Nov 2021 02:10:01 +0000 (21:10 -0500)]
ci: drop appveyor

2 years ago Remove grave accent that shouldn't be there
r00ster [Mon, 1 Nov 2021 18:53:35 +0000 (19:53 +0100)]
 Remove grave accent that shouldn't be there

2 years agoUse a custom env var for log settings intead of default RUST_LOG
Peter Hall [Wed, 7 Oct 2020 11:55:01 +0000 (12:55 +0100)]
Use a custom env var for log settings intead of default RUST_LOG

# Conflicts:
# src/rustfmt/main.rs

2 years agoPrevent trailing whitespace in where clause bound predicate
Yacin Tmimi [Fri, 8 Oct 2021 23:22:12 +0000 (19:22 -0400)]
Prevent trailing whitespace in where clause bound predicate

resolves 5012
resolves 4850

This behavior was noticed when using the ``trailing_comma = "Never"``
configuration option (5012).

This behavior was also noticed when using default configurations (4850).

rustfmt would add a trailing space to where clause bounds that had an
empty right hand side.

Now no trailing space is added to the end of these where clause bounds.

2 years agoDocument RUSTFMT environment variable (#4464)
Jonathan [Sun, 11 Oct 2020 16:28:45 +0000 (16:28 +0000)]
Document RUSTFMT environment variable (#4464)

* Document RUSTFMT env var

* Move documentation up

* Apply suggestions from code review

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

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

2 years agoFix MSRV
chansuke [Wed, 25 Nov 2020 10:31:02 +0000 (19:31 +0900)]
Fix MSRV

2 years agoREADME grammar fix (#3926)
enterprisey [Thu, 14 Nov 2019 14:44:59 +0000 (09:44 -0500)]
README grammar fix (#3926)

Remove comma splice

2 years agorefactor: minor parser cleanup
Caleb Cartwright [Sat, 30 Oct 2021 15:10:08 +0000 (10:10 -0500)]
refactor: minor parser cleanup

2 years agoRetain trailing comments in module when using rustfmt::skip attribute
Yacin Tmimi [Tue, 19 Oct 2021 05:14:51 +0000 (01:14 -0400)]
Retain trailing comments in module when using rustfmt::skip attribute

Resolves 5033

Trailing comments at the end of the root Module were removed because the
module span did not extend until the end of the file.

The root Module's span now encompasses the entire file, which ensures
that no comments are lost when using ``#![rustfmt::skip]``

2 years agoRemove legacy-rustfmt.toml (#4169)
Seiichi Uchida [Mon, 11 May 2020 00:50:41 +0000 (09:50 +0900)]
Remove legacy-rustfmt.toml (#4169)

2 years agofix a bunch of the other clippy warnings that look interesting
Matthias Krüger [Sat, 23 Oct 2021 21:21:52 +0000 (23:21 +0200)]
fix a bunch of the other clippy warnings that look interesting

2 years agofix clippy::needless_borrow
Matthias Krüger [Sat, 23 Oct 2021 21:07:57 +0000 (23:07 +0200)]
fix clippy::needless_borrow

2 years agoAdd rustdoc CI check
Yacin Tmimi [Sat, 23 Oct 2021 21:18:47 +0000 (17:18 -0400)]
Add rustdoc CI check

Resolves 5038

rust-lang/rust builds now document rustfmt (rust-lang/rust#87119). The
build process is updated with doc checks to ensure that rustfmt doesn't
introduce warnings.

Warnings are treated as hard errors in rust-lang/rust and won't show
until bors tests the changes (refs rust-lang/rust#90087).

2 years agoMerge pull request #5043 from calebcartwright/another-subtree-sync
Caleb Cartwright [Sun, 24 Oct 2021 19:56:55 +0000 (14:56 -0500)]
Merge pull request #5043 from calebcartwright/another-subtree-sync

sync subtree

2 years agoMerge remote-tracking branch 'upstream/master' into another-subtree-sync
Caleb Cartwright [Sun, 24 Oct 2021 18:45:19 +0000 (13:45 -0500)]
Merge remote-tracking branch 'upstream/master' into another-subtree-sync

2 years agoAdd One option to group_imports (#4966)
Martinez [Sat, 23 Oct 2021 16:01:48 +0000 (19:01 +0300)]
Add One option to group_imports (#4966)

* Add Together option to group_imports

* Rename option to One

* Rename files from Together to One