mirror of https://github.com/rust-lang/rust.git
Delete spaces
This commit is contained in:
parent
fb3ea63d9b
commit
e84c9aed6d
|
@ -9,7 +9,7 @@ along with any information you feel relevant to replicating the bug.
|
||||||
|
|
||||||
If you cannot produce a minimal reproduction case (something that would work in
|
If you cannot produce a minimal reproduction case (something that would work in
|
||||||
isolation), please provide the steps or even link to a repository that causes
|
isolation), please provide the steps or even link to a repository that causes
|
||||||
the problematic output to occur.
|
the problematic output to occur.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Given the following code: <!-- Please provide a link to play.rust-lang.org -->
|
Given the following code: <!-- Please provide a link to play.rust-lang.org -->
|
||||||
|
|
|
@ -21,7 +21,7 @@ Read ["Installation"] from [The Book].
|
||||||
The Rust build system uses a Python script called `x.py` to build the compiler,
|
The Rust build system uses a Python script called `x.py` to build the compiler,
|
||||||
which manages the bootstrapping process. It lives in the root of the project.
|
which manages the bootstrapping process. It lives in the root of the project.
|
||||||
|
|
||||||
The `x.py` command can be run directly on most systems in the following format:
|
The `x.py` command can be run directly on most systems in the following format:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./x.py <subcommand> [flags]
|
./x.py <subcommand> [flags]
|
||||||
|
|
|
@ -174,7 +174,7 @@ Language
|
||||||
--------
|
--------
|
||||||
- [You can now parameterize items such as functions, traits, and `struct`s by constant
|
- [You can now parameterize items such as functions, traits, and `struct`s by constant
|
||||||
values in addition to by types and lifetimes.][79135] Also known as "const generics"
|
values in addition to by types and lifetimes.][79135] Also known as "const generics"
|
||||||
E.g. you can now write the following. Note: Only values of primitive integers,
|
E.g. you can now write the following. Note: Only values of primitive integers,
|
||||||
`bool`, or `char` types are currently permitted.
|
`bool`, or `char` types are currently permitted.
|
||||||
```rust
|
```rust
|
||||||
struct GenericArray<T, const LENGTH: usize> {
|
struct GenericArray<T, const LENGTH: usize> {
|
||||||
|
|
|
@ -567,8 +567,8 @@ changelog-seen = 2
|
||||||
# On Linux target, if crt-static is not enabled, 'no' means dynamic link to
|
# On Linux target, if crt-static is not enabled, 'no' means dynamic link to
|
||||||
# `libgcc_s.so`, 'in-tree' means static link to the in-tree build of llvm libunwind
|
# `libgcc_s.so`, 'in-tree' means static link to the in-tree build of llvm libunwind
|
||||||
# and 'system' means dynamic link to `libunwind.so`. If crt-static is enabled,
|
# and 'system' means dynamic link to `libunwind.so`. If crt-static is enabled,
|
||||||
# the behavior is depend on the libc. On musl target, 'no' and 'in-tree' both
|
# the behavior is depend on the libc. On musl target, 'no' and 'in-tree' both
|
||||||
# means static link to the in-tree build of llvm libunwind, and 'system' means
|
# means static link to the in-tree build of llvm libunwind, and 'system' means
|
||||||
# static link to `libunwind.a` provided by system. Due to the limitation of glibc,
|
# static link to `libunwind.a` provided by system. Due to the limitation of glibc,
|
||||||
# it must link to `libgcc_eh.a` to get a working output, and this option have no effect.
|
# it must link to `libgcc_eh.a` to get a working output, and this option have no effect.
|
||||||
#llvm-libunwind = 'no'
|
#llvm-libunwind = 'no'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A.
|
Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A.
|
||||||
with Reserved Font Name < Fira >,
|
with Reserved Font Name < Fira >,
|
||||||
|
|
||||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
This license is copied below, and is also available with a FAQ at:
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
@ -19,7 +19,7 @@ with others.
|
||||||
|
|
||||||
The OFL allows the licensed fonts to be used, studied, modified and
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
redistributed freely as long as they are not sold by themselves. The
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
fonts, including any derivative works, can be bundled, embedded,
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
redistributed and/or sold with any software provided that any reserved
|
redistributed and/or sold with any software provided that any reserved
|
||||||
names are not used by derivative works. The fonts and derivatives,
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
however, cannot be released under any other type of license. The
|
however, cannot be released under any other type of license. The
|
||||||
|
|
|
@ -342,7 +342,7 @@ We have prioritization labels and a sync-blocker label, which are described belo
|
||||||
- [P-low][p-low]: Requires attention (fix/response/evaluation) by a team member but isn't urgent.
|
- [P-low][p-low]: Requires attention (fix/response/evaluation) by a team member but isn't urgent.
|
||||||
- [P-medium][p-medium]: Should be addressed by a team member until the next sync.
|
- [P-medium][p-medium]: Should be addressed by a team member until the next sync.
|
||||||
- [P-high][p-high]: Should be immediately addressed and will require an out-of-cycle sync or a backport.
|
- [P-high][p-high]: Should be immediately addressed and will require an out-of-cycle sync or a backport.
|
||||||
- [L-sync-blocker][l-sync-blocker]: An issue that "blocks" a sync.
|
- [L-sync-blocker][l-sync-blocker]: An issue that "blocks" a sync.
|
||||||
Or rather: before the sync this should be addressed,
|
Or rather: before the sync this should be addressed,
|
||||||
e.g. by removing a lint again, so it doesn't hit beta/stable.
|
e.g. by removing a lint again, so it doesn't hit beta/stable.
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ As with `cargo check`, this includes dependencies that are members of the worksp
|
||||||
If you want to run Clippy **only** on the given crate, use the `--no-deps` option like this:
|
If you want to run Clippy **only** on the given crate, use the `--no-deps` option like this:
|
||||||
|
|
||||||
```terminal
|
```terminal
|
||||||
cargo clippy -p example -- --no-deps
|
cargo clippy -p example -- --no-deps
|
||||||
```
|
```
|
||||||
|
|
||||||
### As a rustc replacement (`clippy-driver`)
|
### As a rustc replacement (`clippy-driver`)
|
||||||
|
|
|
@ -178,7 +178,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
|
||||||
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, |l, r| eq_qself(l, r)) && eq_path(lp, rp),
|
(Path(lq, lp), Path(rq, rp)) => both(lq, rq, |l, r| eq_qself(l, r)) && eq_path(lp, rp),
|
||||||
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
|
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
|
||||||
(Struct(lse), Struct(rse)) => {
|
(Struct(lse), Struct(rse)) => {
|
||||||
eq_maybe_qself(&lse.qself, &rse.qself)
|
eq_maybe_qself(&lse.qself, &rse.qself)
|
||||||
&& eq_path(&lse.path, &rse.path)
|
&& eq_path(&lse.path, &rse.path)
|
||||||
&& eq_struct_rest(&lse.rest, &rse.rest)
|
&& eq_struct_rest(&lse.rest, &rse.rest)
|
||||||
&& unordered_over(&lse.fields, &rse.fields, |l, r| eq_field(l, r))
|
&& unordered_over(&lse.fields, &rse.fields, |l, r| eq_field(l, r))
|
||||||
|
|
|
@ -96,9 +96,9 @@ cargo dev ide_setup
|
||||||
|
|
||||||
## lintcheck
|
## lintcheck
|
||||||
`cargo lintcheck` will build and run clippy on a fixed set of crates and generate a log of the results.
|
`cargo lintcheck` will build and run clippy on a fixed set of crates and generate a log of the results.
|
||||||
You can `git diff` the updated log against its previous version and
|
You can `git diff` the updated log against its previous version and
|
||||||
see what impact your lint made on a small set of crates.
|
see what impact your lint made on a small set of crates.
|
||||||
If you add a new lint, please audit the resulting warnings and make sure
|
If you add a new lint, please audit the resulting warnings and make sure
|
||||||
there are no false positives and that the suggestions are valid.
|
there are no false positives and that the suggestions are valid.
|
||||||
|
|
||||||
Refer to the tools [README] for more details.
|
Refer to the tools [README] for more details.
|
||||||
|
|
|
@ -73,5 +73,5 @@ You can run `./lintcheck/target/debug/lintcheck --fix` which will run Clippy wit
|
||||||
print a warning if Clippys suggestions fail to apply (if the resulting code does not build).
|
print a warning if Clippys suggestions fail to apply (if the resulting code does not build).
|
||||||
This lets us spot bad suggestions or false positives automatically in some cases.
|
This lets us spot bad suggestions or false positives automatically in some cases.
|
||||||
|
|
||||||
Please note that the target dir should be cleaned afterwards since clippy will modify
|
Please note that the target dir should be cleaned afterwards since clippy will modify
|
||||||
the downloaded sources which can lead to unexpected results when running lintcheck again afterwards.
|
the downloaded sources which can lead to unexpected results when running lintcheck again afterwards.
|
||||||
|
|
|
@ -363,7 +363,7 @@
|
||||||
|
|
||||||
$scope.bySearch = function (lint, index, array) {
|
$scope.bySearch = function (lint, index, array) {
|
||||||
let searchStr = $scope.search;
|
let searchStr = $scope.search;
|
||||||
// It can be `null` I haven't missed this value
|
// It can be `null` I haven't missed this value
|
||||||
if (searchStr == null || searchStr.length < 3) {
|
if (searchStr == null || searchStr.length < 3) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search the description
|
// Search the description
|
||||||
// The use of `for`-loops instead of `foreach` enables us to return early
|
// The use of `for`-loops instead of `foreach` enables us to return early
|
||||||
let terms = searchStr.split(" ");
|
let terms = searchStr.split(" ");
|
||||||
for (index = 0; index < terms.length; index++) {
|
for (index = 0; index < terms.length; index++) {
|
||||||
if (lint.id.indexOf(terms[index]) !== -1) {
|
if (lint.id.indexOf(terms[index]) !== -1) {
|
||||||
|
@ -463,7 +463,7 @@
|
||||||
|
|
||||||
let children = themeMenu.children;
|
let children = themeMenu.children;
|
||||||
for (let index = 0; index < children.length; index++) {
|
for (let index = 0; index < children.length; index++) {
|
||||||
let child = children[index];
|
let child = children[index];
|
||||||
child.addEventListener("click", function(e) {
|
child.addEventListener("click", function(e) {
|
||||||
setTheme(child.id, true);
|
setTheme(child.id, true);
|
||||||
});
|
});
|
||||||
|
@ -476,7 +476,7 @@
|
||||||
let enableHighlight = false;
|
let enableHighlight = false;
|
||||||
let enableNight = false;
|
let enableNight = false;
|
||||||
let enableAyu = false;
|
let enableAyu = false;
|
||||||
|
|
||||||
if (theme == "ayu") {
|
if (theme == "ayu") {
|
||||||
enableAyu = true;
|
enableAyu = true;
|
||||||
} else if (theme == "coal" || theme == "navy") {
|
} else if (theme == "coal" || theme == "navy") {
|
||||||
|
|
|
@ -176,7 +176,7 @@ https://rust-lang.github.io/rustfmt/?version=v1.4.33&search=#imports_granularity
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Original comment indentation for trailing comments within an `if` is now taken into account when determining the indentation level to use for the trailing comment in formatted code. This does not modify any existing code formatted with rustfmt; it simply gives the programmer discretion to specify whether the comment is associated to the `else` block, or if the trailing comment is just a member of the `if` block. ([#1575](https://github.com/rust-lang/rustfmt/issues/1575), [#4120](https://github.com/rust-lang/rustfmt/issues/4120), [#4506](https://github.com/rust-lang/rustfmt/issues/4506))
|
- Original comment indentation for trailing comments within an `if` is now taken into account when determining the indentation level to use for the trailing comment in formatted code. This does not modify any existing code formatted with rustfmt; it simply gives the programmer discretion to specify whether the comment is associated to the `else` block, or if the trailing comment is just a member of the `if` block. ([#1575](https://github.com/rust-lang/rustfmt/issues/1575), [#4120](https://github.com/rust-lang/rustfmt/issues/4120), [#4506](https://github.com/rust-lang/rustfmt/issues/4506))
|
||||||
|
|
||||||
In this example the `// else comment` refers to the `else`:
|
In this example the `// else comment` refers to the `else`:
|
||||||
```rust
|
```rust
|
||||||
|
@ -213,7 +213,7 @@ if toks.eat_token(Token::Word("modify"))? && toks.eat_token(Token::Word("labels"
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Formatting of empty blocks with attributes which only contained comments is no longer butchered.([#4475](https://github.com/rust-lang/rustfmt/issues/4475), [#4467](https://github.com/rust-lang/rustfmt/issues/4467), [#4452](https://github.com/rust-lang/rustfmt/issues/4452#issuecomment-705886282), [#4522](https://github.com/rust-lang/rustfmt/issues/4522))
|
- Formatting of empty blocks with attributes which only contained comments is no longer butchered.([#4475](https://github.com/rust-lang/rustfmt/issues/4475), [#4467](https://github.com/rust-lang/rustfmt/issues/4467), [#4452](https://github.com/rust-lang/rustfmt/issues/4452#issuecomment-705886282), [#4522](https://github.com/rust-lang/rustfmt/issues/4522))
|
||||||
- Indentation of trailing comments in non-empty extern blocks is now correct. ([#4120](https://github.com/rust-lang/rustfmt/issues/4120#issuecomment-696491872))
|
- Indentation of trailing comments in non-empty extern blocks is now correct. ([#4120](https://github.com/rust-lang/rustfmt/issues/4120#issuecomment-696491872))
|
||||||
|
|
||||||
### Install/Download Options
|
### Install/Download Options
|
||||||
- **crates.io package** - *pending*
|
- **crates.io package** - *pending*
|
||||||
|
@ -297,7 +297,7 @@ if toks.eat_token(Token::Word("modify"))? && toks.eat_token(Token::Word("labels"
|
||||||
- Fix aligning comments of different group
|
- Fix aligning comments of different group
|
||||||
- Fix flattening imports with a single `self`.
|
- Fix flattening imports with a single `self`.
|
||||||
- Fix removing attributes on function parameters.
|
- Fix removing attributes on function parameters.
|
||||||
- Fix removing `impl` keyword from opaque type.
|
- Fix removing `impl` keyword from opaque type.
|
||||||
|
|
||||||
## [1.4.8] 2019-09-08
|
## [1.4.8] 2019-09-08
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ if toks.eat_token(Token::Word("modify"))? && toks.eat_token(Token::Word("labels"
|
||||||
|
|
||||||
- Add `--message-format` command line option to `cargo-fmt`.
|
- Add `--message-format` command line option to `cargo-fmt`.
|
||||||
- Add `-l,--files-with-diff` command line option to `rustfmt`.
|
- Add `-l,--files-with-diff` command line option to `rustfmt`.
|
||||||
- Add `json` emit mode.
|
- Add `json` emit mode.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ if toks.eat_token(Token::Word("modify"))? && toks.eat_token(Token::Word("labels"
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Add new attribute `rustfmt::skip::attributes` to prevent rustfmt
|
- Add new attribute `rustfmt::skip::attributes` to prevent rustfmt
|
||||||
from formatting an attribute #3665
|
from formatting an attribute #3665
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -17,7 +17,7 @@ To enable unstable options, set `unstable_features = true` in `rustfmt.toml` or
|
||||||
|
|
||||||
Below you find a detailed visual guide on all the supported configuration options of rustfmt:
|
Below you find a detailed visual guide on all the supported configuration options of rustfmt:
|
||||||
|
|
||||||
## `array_width`
|
## `array_width`
|
||||||
|
|
||||||
Maximum width of an array literal before falling back to vertical formatting.
|
Maximum width of an array literal before falling back to vertical formatting.
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@ Maximum width of an array literal before falling back to vertical formatting.
|
||||||
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
||||||
- **Stable**: Yes
|
- **Stable**: Yes
|
||||||
|
|
||||||
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `array_width` will take precedence.
|
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `array_width` will take precedence.
|
||||||
|
|
||||||
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
||||||
|
|
||||||
## `attr_fn_like_width`
|
## `attr_fn_like_width`
|
||||||
|
|
||||||
Maximum width of the args of a function-like attributes before falling back to vertical formatting.
|
Maximum width of the args of a function-like attributes before falling back to vertical formatting.
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ Maximum width of the args of a function-like attributes before falling back to v
|
||||||
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
||||||
- **Stable**: Yes
|
- **Stable**: Yes
|
||||||
|
|
||||||
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `attr_fn_like_width` will take precedence.
|
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `attr_fn_like_width` will take precedence.
|
||||||
|
|
||||||
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ where
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `chain_width`
|
## `chain_width`
|
||||||
|
|
||||||
Maximum width of a chain to fit on one line.
|
Maximum width of a chain to fit on one line.
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ Maximum width of a chain to fit on one line.
|
||||||
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
||||||
- **Stable**: Yes
|
- **Stable**: Yes
|
||||||
|
|
||||||
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `chain_width` will take precedence.
|
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `chain_width` will take precedence.
|
||||||
|
|
||||||
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
||||||
|
|
||||||
|
@ -751,7 +751,7 @@ trait Lorem {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## `fn_call_width`
|
## `fn_call_width`
|
||||||
|
|
||||||
Maximum width of the args of a function call before falling back to vertical formatting.
|
Maximum width of the args of a function call before falling back to vertical formatting.
|
||||||
|
|
||||||
|
@ -759,7 +759,7 @@ Maximum width of the args of a function call before falling back to vertical for
|
||||||
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
||||||
- **Stable**: Yes
|
- **Stable**: Yes
|
||||||
|
|
||||||
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `fn_call_width` will take precedence.
|
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `fn_call_width` will take precedence.
|
||||||
|
|
||||||
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
||||||
|
|
||||||
|
@ -2124,7 +2124,7 @@ Don't reformat out of line modules
|
||||||
- **Possible values**: `true`, `false`
|
- **Possible values**: `true`, `false`
|
||||||
- **Stable**: No (tracking issue: #3389)
|
- **Stable**: No (tracking issue: #3389)
|
||||||
|
|
||||||
## `single_line_if_else_max_width`
|
## `single_line_if_else_max_width`
|
||||||
|
|
||||||
Maximum line length for single line if-else expressions. A value of `0` (zero) results in if-else expressions always being broken into multiple lines. Note this occurs when `use_small_heuristics` is set to `Off`.
|
Maximum line length for single line if-else expressions. A value of `0` (zero) results in if-else expressions always being broken into multiple lines. Note this occurs when `use_small_heuristics` is set to `Off`.
|
||||||
|
|
||||||
|
@ -2132,7 +2132,7 @@ Maximum line length for single line if-else expressions. A value of `0` (zero) r
|
||||||
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
||||||
- **Stable**: Yes
|
- **Stable**: Yes
|
||||||
|
|
||||||
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `single_line_if_else_max_width` will take precedence.
|
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `single_line_if_else_max_width` will take precedence.
|
||||||
|
|
||||||
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
||||||
|
|
||||||
|
@ -2313,7 +2313,7 @@ fn main() {
|
||||||
|
|
||||||
See also: [`indent_style`](#indent_style).
|
See also: [`indent_style`](#indent_style).
|
||||||
|
|
||||||
## `struct_lit_width`
|
## `struct_lit_width`
|
||||||
|
|
||||||
Maximum width in the body of a struct literal before falling back to vertical formatting. A value of `0` (zero) results in struct literals always being broken into multiple lines. Note this occurs when `use_small_heuristics` is set to `Off`.
|
Maximum width in the body of a struct literal before falling back to vertical formatting. A value of `0` (zero) results in struct literals always being broken into multiple lines. Note this occurs when `use_small_heuristics` is set to `Off`.
|
||||||
|
|
||||||
|
@ -2321,11 +2321,11 @@ Maximum width in the body of a struct literal before falling back to vertical fo
|
||||||
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
||||||
- **Stable**: Yes
|
- **Stable**: Yes
|
||||||
|
|
||||||
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `struct_lit_width` will take precedence.
|
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `struct_lit_width` will take precedence.
|
||||||
|
|
||||||
See also [`max_width`](#max_width), [`use_small_heuristics`](#use_small_heuristics), and [`struct_lit_single_line`](#struct_lit_single_line)
|
See also [`max_width`](#max_width), [`use_small_heuristics`](#use_small_heuristics), and [`struct_lit_single_line`](#struct_lit_single_line)
|
||||||
|
|
||||||
## `struct_variant_width`
|
## `struct_variant_width`
|
||||||
|
|
||||||
Maximum width in the body of a struct variant before falling back to vertical formatting. A value of `0` (zero) results in struct literals always being broken into multiple lines. Note this occurs when `use_small_heuristics` is set to `Off`.
|
Maximum width in the body of a struct variant before falling back to vertical formatting. A value of `0` (zero) results in struct literals always being broken into multiple lines. Note this occurs when `use_small_heuristics` is set to `Off`.
|
||||||
|
|
||||||
|
@ -2333,7 +2333,7 @@ Maximum width in the body of a struct variant before falling back to vertical fo
|
||||||
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
|
||||||
- **Stable**: Yes
|
- **Stable**: Yes
|
||||||
|
|
||||||
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `struct_variant_width` will take precedence.
|
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `struct_variant_width` will take precedence.
|
||||||
|
|
||||||
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuristics)
|
||||||
|
|
||||||
|
@ -2530,7 +2530,7 @@ fn main() {
|
||||||
|
|
||||||
This option can be used to simplify the management and bulk updates of the granular width configuration settings ([`fn_call_width`](#fn_call_width), [`attr_fn_like_width`](#attr_fn_like_width), [`struct_lit_width`](#struct_lit_width), [`struct_variant_width`](#struct_variant_width), [`array_width`](#array_width), [`chain_width`](#chain_width), [`single_line_if_else_max_width`](#single_line_if_else_max_width)), that respectively control when formatted constructs are multi-lined/vertical based on width.
|
This option can be used to simplify the management and bulk updates of the granular width configuration settings ([`fn_call_width`](#fn_call_width), [`attr_fn_like_width`](#attr_fn_like_width), [`struct_lit_width`](#struct_lit_width), [`struct_variant_width`](#struct_variant_width), [`array_width`](#array_width), [`chain_width`](#chain_width), [`single_line_if_else_max_width`](#single_line_if_else_max_width)), that respectively control when formatted constructs are multi-lined/vertical based on width.
|
||||||
|
|
||||||
Note that explicitly provided values for the width configuration settings take precedence and override the calculated values determined by `use_small_heuristics`.
|
Note that explicitly provided values for the width configuration settings take precedence and override the calculated values determined by `use_small_heuristics`.
|
||||||
|
|
||||||
- **Default value**: `"Default"`
|
- **Default value**: `"Default"`
|
||||||
- **Possible values**: `"Default"`, `"Off"`, `"Max"`
|
- **Possible values**: `"Default"`, `"Off"`, `"Max"`
|
||||||
|
@ -2595,7 +2595,7 @@ fn main() {
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `Off`:
|
#### `Off`:
|
||||||
When `use_small_heuristics` is set to `Off`, the granular width settings are functionally disabled and ignored. See the documentation for the respective width config options for specifics.
|
When `use_small_heuristics` is set to `Off`, the granular width settings are functionally disabled and ignored. See the documentation for the respective width config options for specifics.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
enum Lorem {
|
enum Lorem {
|
||||||
|
|
|
@ -38,7 +38,7 @@ colourised diff will be printed so that the offending line(s) can quickly be
|
||||||
identified.
|
identified.
|
||||||
|
|
||||||
Without explicit settings, the tests will be run using rustfmt's default
|
Without explicit settings, the tests will be run using rustfmt's default
|
||||||
configuration. It is possible to run a test using non-default settings in several
|
configuration. It is possible to run a test using non-default settings in several
|
||||||
ways. Firstly, you can include configuration parameters in comments at the top
|
ways. Firstly, you can include configuration parameters in comments at the top
|
||||||
of the file. For example: to use 3 spaces per tab, start your test with
|
of the file. For example: to use 3 spaces per tab, start your test with
|
||||||
`// rustfmt-tab_spaces: 3`. Just remember that the comment is part of the input,
|
`// rustfmt-tab_spaces: 3`. Just remember that the comment is part of the input,
|
||||||
|
|
|
@ -150,8 +150,8 @@ for its configuration.
|
||||||
|
|
||||||
Our visitor keeps track of the desired current indent due to blocks (
|
Our visitor keeps track of the desired current indent due to blocks (
|
||||||
`block_indent`). Each `visit_*` method reformats code according to this indent,
|
`block_indent`). Each `visit_*` method reformats code according to this indent,
|
||||||
`config.comment_width()` and `config.max_width()`. Most reformatting that is done
|
`config.comment_width()` and `config.max_width()`. Most reformatting that is done
|
||||||
in the `visit_*` methods is a bit hacky and is meant to be temporary until it can
|
in the `visit_*` methods is a bit hacky and is meant to be temporary until it can
|
||||||
be done properly.
|
be done properly.
|
||||||
|
|
||||||
There are a bunch of methods called `rewrite_*`. They do the bulk of the
|
There are a bunch of methods called `rewrite_*`. They do the bulk of the
|
||||||
|
|
|
@ -180,13 +180,13 @@ needs to be specified in `rustfmt.toml`, e.g., with `edition = "2018"`.
|
||||||
|
|
||||||
* For things you do not want rustfmt to mangle, use `#[rustfmt::skip]`
|
* For things you do not want rustfmt to mangle, use `#[rustfmt::skip]`
|
||||||
* To prevent rustfmt from formatting a macro or an attribute,
|
* To prevent rustfmt from formatting a macro or an attribute,
|
||||||
use `#[rustfmt::skip::macros(target_macro_name)]` or
|
use `#[rustfmt::skip::macros(target_macro_name)]` or
|
||||||
`#[rustfmt::skip::attributes(target_attribute_name)]`
|
`#[rustfmt::skip::attributes(target_attribute_name)]`
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
#![rustfmt::skip::attributes(custom_attribute)]
|
#![rustfmt::skip::attributes(custom_attribute)]
|
||||||
|
|
||||||
#[custom_attribute(formatting , here , should , be , Skipped)]
|
#[custom_attribute(formatting , here , should , be , Skipped)]
|
||||||
#[rustfmt::skip::macros(html)]
|
#[rustfmt::skip::macros(html)]
|
||||||
|
|
|
@ -15,7 +15,7 @@ set -ex
|
||||||
# it again.
|
# it again.
|
||||||
#
|
#
|
||||||
#which cargo-fmt || cargo install --force
|
#which cargo-fmt || cargo install --force
|
||||||
CFG_RELEASE=nightly CFG_RELEASE_CHANNEL=nightly cargo install --path . --force
|
CFG_RELEASE=nightly CFG_RELEASE_CHANNEL=nightly cargo install --path . --force
|
||||||
|
|
||||||
echo "Integration tests for: ${INTEGRATION}"
|
echo "Integration tests for: ${INTEGRATION}"
|
||||||
cargo fmt -- --version
|
cargo fmt -- --version
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
outputHtml() {
|
outputHtml() {
|
||||||
const ast = this.configurationDescriptions
|
const ast = this.configurationDescriptions
|
||||||
.filter(({ head, text, stable }) => {
|
.filter(({ head, text, stable }) => {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
text.includes(this.searchCondition) === false &&
|
text.includes(this.searchCondition) === false &&
|
||||||
head.includes(this.searchCondition) === false
|
head.includes(this.searchCondition) === false
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
},
|
},
|
||||||
created: async function() {
|
created: async function() {
|
||||||
const res = await axios.get(ConfigurationMdUrl);
|
const res = await axios.get(ConfigurationMdUrl);
|
||||||
const {
|
const {
|
||||||
about,
|
about,
|
||||||
configurationAbout,
|
configurationAbout,
|
||||||
configurationDescriptions
|
configurationDescriptions
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
const lastIndex = stack.length - 1;
|
const lastIndex = stack.length - 1;
|
||||||
stack[lastIndex].push(next);
|
stack[lastIndex].push(next);
|
||||||
return stack;
|
return stack;
|
||||||
},
|
},
|
||||||
[[]]);
|
[[]]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
configurationAbout, ...configurationDescriptions
|
configurationAbout, ...configurationDescriptions
|
||||||
] = configurations;
|
] = configurations;
|
||||||
configurationAbout.value.links = {};
|
configurationAbout.value.links = {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
about,
|
about,
|
||||||
configurationAbout: configurationAbout.value,
|
configurationAbout: configurationAbout.value,
|
||||||
|
|
Loading…
Reference in New Issue