Skip to content

Fix multiline comment indentation #4617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fe7fac0
Fix multiline comment indentation with debug info
davidBar-On Dec 31, 2020
3c09895
Remove debug info
davidBar-On Dec 31, 2020
025f780
ci: fix linking issue on windows gnu jobs
calebcartwright Jan 1, 2021
fad96d0
Add support for edition 2021.
m-ou-se Jan 1, 2021
0d6ac07
Fixes for new rustc changes.
m-ou-se Jan 1, 2021
20d6d17
Bump rustc-ap to v697.
m-ou-se Jan 1, 2021
53f40b4
Account for new ast::GenericParamKind::Const::default in rust_ast.
m-ou-se Jan 1, 2021
f2b9841
Fix expected macro formatting test output.
m-ou-se Jan 1, 2021
5f1a198
Add 2021 test.
m-ou-se Jan 2, 2021
171f9ac
Update Cargo.lock.
m-ou-se Jan 2, 2021
9db333c
Use rewrite_assign_rhs_with_comments by ControlFlow rewrite_pat_expr
davidBar-On Jan 5, 2021
520635a
refactor: cleanup block check for statements
calebcartwright Jan 7, 2021
ea31b8c
tests: don't strip empty tuple exprs in blocks
calebcartwright Jan 7, 2021
a80d02d
Make `merge_imports` more granular with a `Module` option.
goffrie Dec 16, 2020
e9dd4a0
Continue to parse merge_imports={true,false}
goffrie Dec 21, 2020
5864cec
Rename option to imports_merge_style, still parse the old option
goffrie Dec 24, 2020
11ece8c
Improve documentation for imports_merge_style
goffrie Jan 1, 2021
dc03bc7
Share code with merge_use_trees
goffrie Jan 1, 2021
50d36bb
Rename to imports_granularity
goffrie Jan 1, 2021
17d21ed
fix: indentation issue on generic bounds
calebcartwright Jan 12, 2021
387020a
refactor: remove unneeded clone
calebcartwright Jan 12, 2021
833c6f5
Fixed semicolon getting moved into comment (fixes #4646)
vallentin Jan 17, 2021
280613e
Added 4646 test case
vallentin Jan 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization.
# In order to prevent overusing too much of that 60 limit, we throttle the
# number of rustfmt jobs that will run concurrently.
max-parallel: 1
max-parallel: 2
fail-fast: false
matrix:
target: [
Expand Down Expand Up @@ -50,6 +50,17 @@ jobs:
profile: minimal
default: true

- name: Add mingw32 to path for i686-gnu
run: |
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly'
shell: bash

- name: Add mingw64 to path for x86_64-gnu
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
shell: bash

- name: cargo-make
run: cargo install --force cargo-make

Expand Down
80 changes: 40 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,32 +107,32 @@ lazy_static = "1.0.0"

[dependencies.rustc_ast]
package = "rustc-ap-rustc_ast"
version = "691.0.0"
version = "697.0.0"

[dependencies.rustc_ast_pretty]
package = "rustc-ap-rustc_ast_pretty"
version = "691.0.0"
version = "697.0.0"

[dependencies.rustc_data_structures]
package = "rustc-ap-rustc_data_structures"
version = "691.0.0"
version = "697.0.0"

[dependencies.rustc_errors]
package = "rustc-ap-rustc_errors"
version = "691.0.0"
version = "697.0.0"

[dependencies.rustc_expand]
package = "rustc-ap-rustc_expand"
version = "691.0.0"
version = "697.0.0"

[dependencies.rustc_parse]
package = "rustc-ap-rustc_parse"
version = "691.0.0"
version = "697.0.0"

[dependencies.rustc_session]
package = "rustc-ap-rustc_session"
version = "691.0.0"
version = "697.0.0"

[dependencies.rustc_span]
package = "rustc-ap-rustc_span"
version = "691.0.0"
version = "697.0.0"
54 changes: 48 additions & 6 deletions Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ fn main() {
Specifies which edition is used by the parser.

- **Default value**: `"2015"`
- **Possible values**: `"2015"`, `"2018"`
- **Possible values**: `"2015"`, `"2018"`, `"2021"`
- **Stable**: Yes

Rustfmt is able to pick up the edition used by reading the `Cargo.toml` file if executed
Expand Down Expand Up @@ -1705,13 +1705,56 @@ pub enum Foo {}
pub enum Foo {}
```

## `merge_imports`
## `imports_granularity`

Merge together related imports based on their paths.

- **Default value**: `Preserve`
- **Possible values**: `Preserve`, `Crate`, `Module`
- **Stable**: No

#### `Preserve` (default):

Do not perform any merging and preserve the original structure written by the developer.

```rust
use foo::b;
use foo::b::{f, g};
use foo::{a, c, d::e};
use qux::{h, i};
```

#### `Crate`:

Merge multiple imports into a single nested import.
Merge imports from the same crate into a single `use` statement. Conversely, imports from different crates are split into separate statements.

```rust
use foo::{
a, b,
b::{f, g},
c,
d::e,
};
use qux::{h, i};
```

#### `Module`:

Merge imports from the same module into a single `use` statement. Conversely, imports from different modules are split into separate statements.

```rust
use foo::b::{f, g};
use foo::d::e;
use foo::{a, b, c};
use qux::{h, i};
```

## `merge_imports`

This option is deprecated. Use `imports_granularity = "Crate"` instead.

- **Default value**: `false`
- **Possible values**: `true`, `false`
- **Stable**: No (tracking issue: [#3362](https://github.com/rust-lang/rustfmt/issues/3362))

#### `false` (default):

Expand All @@ -1727,7 +1770,6 @@ use foo::{e, f};
use foo::{a, b, c, d, e, f, g};
```


## `newline_style`

Unix or Windows line endings
Expand Down Expand Up @@ -2560,7 +2602,7 @@ Enable unstable features on stable and beta channels (unstable features are avai

For example:
```bash
rustfmt src/lib.rs --config unstable_features=true merge_imports=true
rustfmt src/lib.rs --config unstable_features=true imports_granularity=Crate
```

## `use_field_init_shorthand`
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2020-11-29
nightly-2020-12-31
Loading