From 2f9057c5599e323eba02ddfcbbfc05ae22b87680 Mon Sep 17 00:00:00 2001
From: Gary Gozlan isinstance
or issubclass
calls where the result is statically determined to be always true. Such calls are often indicative of a programming error.",
+ "title": "Controls reporting calls to `isinstance` or `issubclass` where the result is statically determined to be always (or never) true",
+ "description": "Generate or suppress diagnostics for `isinstance` or `issubclass` calls where the result is statically determined to be always true or always false. Such calls are often indicative of a programming error.",
+ "markdownDescription": "Generate or suppress diagnostics for `isinstance` or `issubclass` calls where the result is statically determined to be always true or always false. Such calls are often indicative of a programming error.",
+ "x-intellij-html-description": "Generate or suppress diagnostics for isinstance
or issubclass
calls where the result is statically determined to be always true or always false. Such calls are often indicative of a programming error.",
"default": "none"
},
"reportUnnecessaryCast": {
From c084075dbfa7eb7da2c4c81456d04543b7be5744 Mon Sep 17 00:00:00 2001
From: Maisa Unbelievable bytearray
to bytes
type. Is set to true
in strict mode."
+ },
+ "disable_memoryview_promotion": {
+ "type": "boolean",
+ "default": false,
+ "description": "UNDOCUMENTED. Disables automatic promotion of `memoryview` to `bytes` type. Is set to `true` in strict mode.",
+ "x-intellij-html-description": "UNDOCUMENTED. Disables automatic promotion of memoryview
to bytes
type. Is set to true
in strict mode."
+ },
+ "enable_incomplete_feature": {
+ "description": "Enable a preview of incomplete features that are not yet enabled by default by the current version of mypy. Note that it is not guaranteed that all features will be ultimately enabled by default.",
+ "x-intellij-html-description": "Enable a preview of incomplete features that are not yet enabled by default by the current version of mypy. Note that it is not guaranteed that all features will be ultimately enabled by default.",
+ "oneOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ ]
+ },
"overrides": {
"type": "array",
"items": {
From 215d9f440925d1e8cd2e495d9cea2be8ef136f15 Mon Sep 17 00:00:00 2001
From: Roger Peppe assert
statement that will provably always assert. This can be indicative of a programming error.",
+ "description": "Generate or suppress diagnostics for `assert` statement that will provably always assert because its first argument is a parenthesized tuple (for example, `assert (v > 0, \"Bad value\")` when the intent was probably `assert v > 0, \"Bad value\"`). This is a common programming error.",
+ "markdownDescription": "Generate or suppress diagnostics for `assert` statement that will provably always assert because its first argument is a parenthesized tuple (for example, `assert (v > 0, \"Bad value\")` when the intent was probably `assert v > 0, \"Bad value\"`). This is a common programming error.",
+ "x-intellij-html-description": "Generate or suppress diagnostics for assert
statement that will provably always assert because its first argument is a parenthesized tuple (for example, assert (v > 0, "Bad value")
when the intent was probably assert v > 0, "Bad value"
). This is a common programming error.",
"default": "warning"
},
"reportSelfClsParameterName": {
From adf3bf6418b5eea34c857b8ed4e107382bcab7ca Mon Sep 17 00:00:00 2001
From: Kevin Kortum
.
and is relative to the file path passed in relative_to
."
+ },
+ "version_scheme": {
+ "type": "string",
+ "description": "An entrypoint name; configures how the local version number is constructed."
+ },
+ "local_scheme": {
+ "type": "string",
+ "description": "An entrypoint name; configures how the local component of the version is constructed."
+ },
+ "version_file": {
+ "type": "string",
+ "description": "A path to a file that gets replaced with a file containing the current version. It is ideal for creating a `_version.py` file within the package, typically used to avoid using `pkg_resources.get_distribution` (which adds some overhead). Only files with `.py` and `.txt` extensions have builtin templates, for other file types it is necessary to provide version_file_template.",
+ "markdownDescription": "A path to a file that gets replaced with a file containing the current version. It is ideal for creating a `_version.py` file within the package, typically used to avoid using `pkg_resources.get_distribution` (which adds some overhead). Only files with `.py` and `.txt` extensions have builtin templates, for other file types it is necessary to provide version_file_template.",
+ "x-intellij-html-description": "A path to a file that gets replaced with a file containing the current version. It is ideal for creating a _version.py
file within the package, typically used to avoid using pkg_resources.get_distribution
(which adds some overhead). Only files with .py
and .txt
extensions have builtin templates, for other file types it is necessary to provide version_file_template."
+ },
+ "version_file_template": {
+ "type": "string",
+ "description": "A new-style format string taking `version`, `scm_version` and `version_tuple` as parameters. `version` is the generated next_version as string, `version_tuple` is a tuple of split numbers/strings and `scm_version` is the `ScmVersion` instance the current `version` was rendered from.",
+ "markdownDescription": "A new-style format string taking `version`, `scm_version` and `version_tuple` as parameters. `version` is the generated next_version as string, `version_tuple` is a tuple of split numbers/strings and `scm_version` is the `ScmVersion` instance the current `version` was rendered from.",
+ "x-intellij-html-description": "A new-style format string taking version
, scm_version
and version_tuple
as parameters. version
is the generated next_version as string, version_tuple
is a tuple of split numbers/strings and scm_version
is the ScmVersion
instance the current version
was rendered from."
+ },
+ "write_to": {
+ "type": "string",
+ "description": "Create a version file relative to the scm root; deprecated in favor of use `version_file` instead.",
+ "markdownDescription": "Create a version file relative to the scm root; deprecated in favor of use `version_file` instead.",
+ "x-intellij-html-description": "Create a version file relative to the scm root; deprecated in favor of use version_file
instead.",
+ "deprecated": true
+ },
+ "relative_to": {
+ "type": "string",
+ "description": "A file/directory from which the root can be resolved. Typically called by a script or module that is not in the root of the repository to point `setuptools_scm` at the root of the repository by supplying `__file__`.",
+ "markdownDescription": "A file/directory from which the root can be resolved. Typically called by a script or module that is not in the root of the repository to point `setuptools_scm` at the root of the repository by supplying `__file__`.",
+ "x-intellij-html-description": "A file/directory from which the root can be resolved. Typically called by a script or module that is not in the root of the repository to point setuptools_scm
at the root of the repository by supplying __file__
.",
+ "default": "pyproject.toml"
+ },
+ "tag_regex": {
+ "type": "string",
+ "description": "A Python regex string to extract the version part from any SCM tag. The regex needs to contain either a single match group, or a group named `version`, that captures the actual version information.",
+ "markdownDescription": "A Python regex string to extract the version part from any SCM tag. The regex needs to contain either a single match group, or a group named `version`, that captures the actual version information.",
+ "x-intellij-html-description": "A Python regex string to extract the version part from any SCM tag. The regex needs to contain either a single match group, or a group named version
, that captures the actual version information.",
+ "default": "^(?:[\\w-]+-)?(?Pparentdir_prefix_version
, then this prefix is stripped and the rest of the parent directory name is matched with tag_regex
to get a version string. If this parameter is unset (the default), then this fallback is not used.\n\nThis was intended to cover GitHub's "release tarballs", which extract into directories named projectname-tag/
(in which case parentdir_prefix_version
can be set e.g. to projectname-
)."
+ },
+ "fallback_version": {
+ "type": "string",
+ "description": "A version string that will be used if no other method for detecting the version worked (e.g., when using a tarball with no metadata). If this is unset (the default), `setuptools-scm` will error if it fails to detect the version.",
+ "markdownDescription": "A version string that will be used if no other method for detecting the version worked (e.g., when using a tarball with no metadata). If this is unset (the default), `setuptools-scm` will error if it fails to detect the version.",
+ "x-intellij-html-description": "A version string that will be used if no other method for detecting the version worked (e.g., when using a tarball with no metadata). If this is unset (the default), setuptools-scm
will error if it fails to detect the version."
+ },
+ "git_describe_command": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "This command will be used instead the default `git describe --long` command.",
+ "markdownDescription": "This command will be used instead the default `git describe --long` command.",
+ "x-intellij-html-description": "This command will be used instead the default git describe --long
command.",
+ "default": [
+ "git",
+ "describe",
+ "--dirty",
+ "--tags",
+ "--long",
+ "--match",
+ "*[0-9]*"
+ ]
+ },
+ "normalize": {
+ "type": "boolean",
+ "description": "A boolean flag indicating if the version string should be normalized.",
+ "default": true
+ },
+ "version_cls": {
+ "type": "string",
+ "description": "Qualified name of an optional class used to parse, verify and possibly normalize the version string. Its constructor should receive a single string argument, and its `str` should return the normalized version string to use.",
+ "markdownDescription": "Qualified name of an optional class used to parse, verify and possibly normalize the version string. Its constructor should receive a single string argument, and its `str` should return the normalized version string to use.",
+ "x-intellij-html-description": "Qualified name of an optional class used to parse, verify and possibly normalize the version string. Its constructor should receive a single string argument, and its str
should return the normalized version string to use.",
+ "default": "packaging.version.Version"
+ }
+ }
+}
diff --git a/src/schemas/json/pyproject.json b/src/schemas/json/pyproject.json
index 77f5b5b69f7..12826803b3d 100644
--- a/src/schemas/json/pyproject.json
+++ b/src/schemas/json/pyproject.json
@@ -120,6 +120,9 @@
"setuptools": {
"$ref": "https://json.schemastore.org/partial-setuptools.json"
},
+ "setuptools_scm": {
+ "$ref": "https://json.schemastore.org/partial-setuptools-scm.json"
+ },
"poetry": {
"$ref": "https://json.schemastore.org/partial-poetry.json"
},
diff --git a/src/test/pyproject/01-setuptools_scm.toml b/src/test/pyproject/01-setuptools_scm.toml
new file mode 100644
index 00000000000..6a0c1bd362c
--- /dev/null
+++ b/src/test/pyproject/01-setuptools_scm.toml
@@ -0,0 +1,2 @@
+[tool.setuptools_scm]
+write_to = "foo/bar.py"
From 885ae76e8bf31be8c484f82c9538a1221653c619 Mon Sep 17 00:00:00 2001
From: Zanie Blue
- See a list + See a list of editors, validators and other software supporting JSON schemas.
From e052626f6afb864eecf4bb62c70d1b0d9dc17817 Mon Sep 17 00:00:00 2001 From: Matthieu DarboisMaximum width of an array literal before falling back to vertical formatting.
\nPossible values: any positive integer that is less than or equal to the value specified for max_width
Stable: Yes
\nBy default this option is set as a percentage of max_width
provided by use_small_heuristics
, but a value set directly for array_width
will take precedence.
See also max_width
and use_small_heuristics
Maximum width of the args of a function-like attributes before falling back to vertical formatting.
\nPossible values: any positive integer that is less than or equal to the value specified for max_width
Stable: Yes
\nBy default this option is set as a percentage of max_width
provided by use_small_heuristics
, but a value set directly for attr_fn_like_width
will take precedence.
See also max_width
and use_small_heuristics
Where to put a binary operator when a binary expression goes multiline.
\nStable: No (tracking issue: #3368)
\n"Front"
(default):fn main() {\n let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo\n || barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar;\n\n let sum = 123456789012345678901234567890\n + 123456789012345678901234567890\n + 123456789012345678901234567890;\n\n let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n ..bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;\n}\n
\n"Back"
:fn main() {\n let or = foofoofoofoofoofoofoofoofoofoofoofoofoofoofoofoo ||\n barbarbarbarbarbarbarbarbarbarbarbarbarbarbarbar;\n\n let sum = 123456789012345678901234567890 +\n 123456789012345678901234567890 +\n 123456789012345678901234567890;\n\n let range = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa..\n bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;\n}\n
\n",
"default": "Front",
"enum": ["Front", "Back"]
},
"blank_lines_lower_bound": {
"type": "integer",
- "description": "Minimum number of blank lines which must be put between items\n\n[Documentation](https://rust-lang.github.io/rustfmt/#blank_lines_lower_bound)\n\n### Unstable\nThis option requires Nightly Rust.",
+ "description": "Minimum number of blank lines which must be put between items. If two items have fewer blank lines between\nthem, additional blank lines are inserted.\n\nPossible values: *unsigned integer*\n\nStable: No (tracking issue: [#3382](https://github.com/rust-lang/rustfmt/issues/3382))\n\n\n### Example\nOriginal Code (rustfmt will not change it with the default value of `0`):\n\n```rust\n#![rustfmt::skip]\n\nfn foo() {\n println!(\"a\");\n}\nfn bar() {\n println!(\"b\");\n println!(\"c\");\n}\n```\n\n#### `1`\n```rust\nfn foo() {\n\n println!(\"a\");\n}\n\nfn bar() {\n\n println!(\"b\");\n\n println!(\"c\");\n}\n```",
+ "markdownDescription": "Minimum number of blank lines which must be put between items. If two items have fewer blank lines between\nthem, additional blank lines are inserted.\n\nPossible values: *unsigned integer*\n\nStable: No (tracking issue: [#3382](https://github.com/rust-lang/rustfmt/issues/3382))\n\n\n### Example\nOriginal Code (rustfmt will not change it with the default value of `0`):\n\n```rust\n#![rustfmt::skip]\n\nfn foo() {\n println!(\"a\");\n}\nfn bar() {\n println!(\"b\");\n println!(\"c\");\n}\n```\n\n#### `1`\n```rust\nfn foo() {\n\n println!(\"a\");\n}\n\nfn bar() {\n\n println!(\"b\");\n\n println!(\"c\");\n}\n```",
+ "x-intellij-html-description": "Minimum number of blank lines which must be put between items. If two items have fewer blank lines between\nthem, additional blank lines are inserted.
\nPossible values: unsigned integer
\nStable: No (tracking issue: #3382)
\nOriginal Code (rustfmt will not change it with the default value of 0
):
#![rustfmt::skip]\n\nfn foo() {\n println!("a");\n}\nfn bar() {\n println!("b");\n println!("c");\n}\n
\n1
fn foo() {\n\n println!("a");\n}\n\nfn bar() {\n\n println!("b");\n\n println!("c");\n}\n
\n",
"default": 0
},
"blank_lines_upper_bound": {
"type": "integer",
- "description": "Maximum number of blank lines which can be put between items\n\n[Documentation](https://rust-lang.github.io/rustfmt/#blank_lines_upper_bound)\n\n### Unstable\nThis option requires Nightly Rust.",
+ "description": "Maximum number of blank lines which can be put between items. If more than this number of consecutive empty\nlines are found, they are trimmed down to match this integer.\n\nPossible values: any non-negative integer\n\nStable: No (tracking issue: [#3381](https://github.com/rust-lang/rustfmt/issues/3381))\n\n\n### Example\nOriginal Code:\n\n```rust\n#![rustfmt::skip]\n\nfn foo() {\n println!(\"a\");\n}\n\n\n\nfn bar() {\n println!(\"b\");\n\n\n println!(\"c\");\n}\n```\n\n#### `1` (default):\n```rust\nfn foo() {\n println!(\"a\");\n}\n\nfn bar() {\n println!(\"b\");\n\n println!(\"c\");\n}\n```\n\n#### `2`:\n```rust\nfn foo() {\n println!(\"a\");\n}\n\n\nfn bar() {\n println!(\"b\");\n\n\n println!(\"c\");\n}\n```\n\nSee also: `blank_lines_lower_bound`",
+ "markdownDescription": "Maximum number of blank lines which can be put between items. If more than this number of consecutive empty\nlines are found, they are trimmed down to match this integer.\n\nPossible values: any non-negative integer\n\nStable: No (tracking issue: [#3381](https://github.com/rust-lang/rustfmt/issues/3381))\n\n\n### Example\nOriginal Code:\n\n```rust\n#![rustfmt::skip]\n\nfn foo() {\n println!(\"a\");\n}\n\n\n\nfn bar() {\n println!(\"b\");\n\n\n println!(\"c\");\n}\n```\n\n#### `1` (default):\n```rust\nfn foo() {\n println!(\"a\");\n}\n\nfn bar() {\n println!(\"b\");\n\n println!(\"c\");\n}\n```\n\n#### `2`:\n```rust\nfn foo() {\n println!(\"a\");\n}\n\n\nfn bar() {\n println!(\"b\");\n\n\n println!(\"c\");\n}\n```\n\nSee also: `blank_lines_lower_bound`",
+ "x-intellij-html-description": "Maximum number of blank lines which can be put between items. If more than this number of consecutive empty\nlines are found, they are trimmed down to match this integer.
\nPossible values: any non-negative integer
\nStable: No (tracking issue: #3381)
\nOriginal Code:
\n#![rustfmt::skip]\n\nfn foo() {\n println!("a");\n}\n\n\n\nfn bar() {\n println!("b");\n\n\n println!("c");\n}\n
\n1
(default):fn foo() {\n println!("a");\n}\n\nfn bar() {\n println!("b");\n\n println!("c");\n}\n
\n2
:fn foo() {\n println!("a");\n}\n\n\nfn bar() {\n println!("b");\n\n\n println!("c");\n}\n
\nSee also: blank_lines_lower_bound
Brace style for items
\nStable: No (tracking issue: #3376)
\n"SameLineWhere"
(default):fn lorem() {\n // body\n}\n\nfn lorem(ipsum: usize) {\n // body\n}\n\nfn lorem<T>(ipsum: T)\nwhere\n T: Add + Sub + Mul + Div,\n{\n // body\n}\n
\n"AlwaysNextLine"
:fn lorem()\n{\n // body\n}\n\nfn lorem(ipsum: usize)\n{\n // body\n}\n\nfn lorem<T>(ipsum: T)\nwhere\n T: Add + Sub + Mul + Div,\n{\n // body\n}\n
\n"PreferSameLine"
:fn lorem() {\n // body\n}\n\nfn lorem(ipsum: usize) {\n // body\n}\n\nfn lorem<T>(ipsum: T)\nwhere\n T: Add + Sub + Mul + Div, {\n // body\n}\n
\n"SameLineWhere"
(default):struct Lorem {\n ipsum: bool,\n}\n\nstruct Dolor<T>\nwhere\n T: Eq,\n{\n sit: T,\n}\n
\n"AlwaysNextLine"
:struct Lorem\n{\n ipsum: bool,\n}\n\nstruct Dolor<T>\nwhere\n T: Eq,\n{\n sit: T,\n}\n
\n"PreferSameLine"
:struct Lorem {\n ipsum: bool,\n}\n\nstruct Dolor<T>\nwhere\n T: Eq, {\n sit: T,\n}\n
\n",
"default": "SameLineWhere",
"enum": ["AlwaysNextLine", "PreferSameLine", "SameLineWhere"]
},
"chain_width": {
"type": "integer",
- "description": "Maximum length of a chain to fit on a single line.\n\n[Documentation](https://rust-lang.github.io/rustfmt/#chain_width)",
+ "description": "Maximum width of a chain to fit on one line.\n\nPossible values: any positive integer that is less than or equal to the value specified for `max_width`\n\nStable: Yes\n\nBy default this option is set as a percentage of `max_width` provided by `use_small_heuristics`, but a value set directly for `chain_width` will take precedence.\n\nSee also `max_width` and `use_small_heuristics`",
+ "markdownDescription": "Maximum width of a chain to fit on one line.\n\nPossible values: any positive integer that is less than or equal to the value specified for `max_width`\n\nStable: Yes\n\nBy default this option is set as a percentage of `max_width` provided by `use_small_heuristics`, but a value set directly for `chain_width` will take precedence.\n\nSee also `max_width` and `use_small_heuristics`",
+ "x-intellij-html-description": "Maximum width of a chain to fit on one line.
\nPossible values: any positive integer that is less than or equal to the value specified for max_width
Stable: Yes
\nBy default this option is set as a percentage of max_width
provided by use_small_heuristics
, but a value set directly for chain_width
will take precedence.
See also max_width
and use_small_heuristics
Whether to use colored output or not.
\nStable: No (tracking issue: #3385)
\n", "default": "Auto", - "enum": ["Always", "Never", "Auto"] + "enum": ["Auto", "Always", "Never"] }, "combine_control_expr": { "type": "boolean", - "description": "Combine control expressions with function calls\n\n[Documentation](https://rust-lang.github.io/rustfmt/#combine_control_expr)\n\n### Unstable\nThis option requires Nightly Rust.", - "default": true, - "enum": [true, false] + "description": "Combine control expressions with function calls.\n\nStable: No (tracking issue: [#3369](https://github.com/rust-lang/rustfmt/issues/3369))\n\n\n#### `true` (default):\n\n```rust\nfn example() {\n // If\n foo!(if x {\n foo();\n } else {\n bar();\n });\n\n // IfLet\n foo!(if let Some(..) = x {\n foo();\n } else {\n bar();\n });\n\n // While\n foo!(while x {\n foo();\n bar();\n });\n\n // WhileLet\n foo!(while let Some(..) = x {\n foo();\n bar();\n });\n\n // ForLoop\n foo!(for x in y {\n foo();\n bar();\n });\n\n // Loop\n foo!(loop {\n foo();\n bar();\n });\n}\n```\n\n#### `false`:\n\n```rust\nfn example() {\n // If\n foo!(\n if x {\n foo();\n } else {\n bar();\n }\n );\n\n // IfLet\n foo!(\n if let Some(..) = x {\n foo();\n } else {\n bar();\n }\n );\n\n // While\n foo!(\n while x {\n foo();\n bar();\n }\n );\n\n // WhileLet\n foo!(\n while let Some(..) = x {\n foo();\n bar();\n }\n );\n\n // ForLoop\n foo!(\n for x in y {\n foo();\n bar();\n }\n );\n\n // Loop\n foo!(\n loop {\n foo();\n bar();\n }\n );\n}\n```", + "markdownDescription": "Combine control expressions with function calls.\n\nStable: No (tracking issue: [#3369](https://github.com/rust-lang/rustfmt/issues/3369))\n\n\n#### `true` (default):\n\n```rust\nfn example() {\n // If\n foo!(if x {\n foo();\n } else {\n bar();\n });\n\n // IfLet\n foo!(if let Some(..) = x {\n foo();\n } else {\n bar();\n });\n\n // While\n foo!(while x {\n foo();\n bar();\n });\n\n // WhileLet\n foo!(while let Some(..) = x {\n foo();\n bar();\n });\n\n // ForLoop\n foo!(for x in y {\n foo();\n bar();\n });\n\n // Loop\n foo!(loop {\n foo();\n bar();\n });\n}\n```\n\n#### `false`:\n\n```rust\nfn example() {\n // If\n foo!(\n if x {\n foo();\n } else {\n bar();\n }\n );\n\n // IfLet\n foo!(\n if let Some(..) = x {\n foo();\n } else {\n bar();\n }\n );\n\n // While\n foo!(\n while x {\n foo();\n bar();\n }\n );\n\n // WhileLet\n foo!(\n while let Some(..) = x {\n foo();\n bar();\n }\n );\n\n // ForLoop\n foo!(\n for x in y {\n foo();\n bar();\n }\n );\n\n // Loop\n foo!(\n loop {\n foo();\n bar();\n }\n );\n}\n```", + "x-intellij-html-description": "Combine control expressions with function calls.
\nStable: No (tracking issue: #3369)
\ntrue
(default):fn example() {\n // If\n foo!(if x {\n foo();\n } else {\n bar();\n });\n\n // IfLet\n foo!(if let Some(..) = x {\n foo();\n } else {\n bar();\n });\n\n // While\n foo!(while x {\n foo();\n bar();\n });\n\n // WhileLet\n foo!(while let Some(..) = x {\n foo();\n bar();\n });\n\n // ForLoop\n foo!(for x in y {\n foo();\n bar();\n });\n\n // Loop\n foo!(loop {\n foo();\n bar();\n });\n}\n
\nfalse
:fn example() {\n // If\n foo!(\n if x {\n foo();\n } else {\n bar();\n }\n );\n\n // IfLet\n foo!(\n if let Some(..) = x {\n foo();\n } else {\n bar();\n }\n );\n\n // While\n foo!(\n while x {\n foo();\n bar();\n }\n );\n\n // WhileLet\n foo!(\n while let Some(..) = x {\n foo();\n bar();\n }\n );\n\n // ForLoop\n foo!(\n for x in y {\n foo();\n bar();\n }\n );\n\n // Loop\n foo!(\n loop {\n foo();\n bar();\n }\n );\n}\n
\n",
+ "default": true
},
"comment_width": {
"type": "integer",
- "description": "Maximum length of comments. No effect unless wrap_comments = true\n\n[Documentation](https://rust-lang.github.io/rustfmt/#comment_width)\n\n### Unstable\nThis option requires Nightly Rust.",
+ "description": "Maximum length of comments. No effect unless `wrap_comments = true`.\n\nPossible values: any positive integer\n\nStable: No (tracking issue: [#3349](https://github.com/rust-lang/rustfmt/issues/3349))\n\n**Note:** A value of `0` results in `wrap_comments` being applied regardless of a line's width.\n\n#### `80` (default; comments shorter than `comment_width`):\n```rust\n// Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n```\n\n#### `60` (comments longer than `comment_width`):\n```rust\n// Lorem ipsum dolor sit amet,\n// consectetur adipiscing elit.\n```\n\nSee also `wrap_comments`.",
+ "markdownDescription": "Maximum length of comments. No effect unless `wrap_comments = true`.\n\nPossible values: any positive integer\n\nStable: No (tracking issue: [#3349](https://github.com/rust-lang/rustfmt/issues/3349))\n\n**Note:** A value of `0` results in `wrap_comments` being applied regardless of a line's width.\n\n#### `80` (default; comments shorter than `comment_width`):\n```rust\n// Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n```\n\n#### `60` (comments longer than `comment_width`):\n```rust\n// Lorem ipsum dolor sit amet,\n// consectetur adipiscing elit.\n```\n\nSee also `wrap_comments`.",
+ "x-intellij-html-description": "Maximum length of comments. No effect unless wrap_comments = true
.
Possible values: any positive integer
\nStable: No (tracking issue: #3349)
\nNote: A value of 0
results in wrap_comments
being applied regardless of a line's width.
80
(default; comments shorter than comment_width
):// Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n
\n60
(comments longer than comment_width
):// Lorem ipsum dolor sit amet,\n// consectetur adipiscing elit.\n
\nSee also wrap_comments
.
Replace strings of _ wildcards by a single .. in tuple patterns
\nStable: No (tracking issue: #3384)
\nfalse
(default):fn main() {\n let (lorem, ipsum, _, _) = (1, 2, 3, 4);\n let (lorem, ipsum, ..) = (1, 2, 3, 4);\n}\n
\ntrue
:fn main() {\n let (lorem, ipsum, ..) = (1, 2, 3, 4);\n}\n
\n",
+ "default": false
},
"control_brace_style": {
"type": "string",
- "description": "Brace style for control flow constructs\n\n[Documentation](https://rust-lang.github.io/rustfmt/#control_brace_style)\n\n### Unstable\nThis option requires Nightly Rust.",
+ "description": "Brace style for control flow constructs\n\nStable: No (tracking issue: [#3377](https://github.com/rust-lang/rustfmt/issues/3377))\n\n\n#### `\"AlwaysSameLine\"` (default):\n\n```rust\nfn main() {\n if lorem {\n println!(\"ipsum!\");\n } else {\n println!(\"dolor!\");\n }\n}\n```\n\n#### `\"AlwaysNextLine\"`:\n\n```rust\nfn main() {\n if lorem\n {\n println!(\"ipsum!\");\n }\n else\n {\n println!(\"dolor!\");\n }\n}\n```\n\n#### `\"ClosingNextLine\"`:\n\n```rust\nfn main() {\n if lorem {\n println!(\"ipsum!\");\n }\n else {\n println!(\"dolor!\");\n }\n}\n```",
+ "markdownDescription": "Brace style for control flow constructs\n\nStable: No (tracking issue: [#3377](https://github.com/rust-lang/rustfmt/issues/3377))\n\n\n#### `\"AlwaysSameLine\"` (default):\n\n```rust\nfn main() {\n if lorem {\n println!(\"ipsum!\");\n } else {\n println!(\"dolor!\");\n }\n}\n```\n\n#### `\"AlwaysNextLine\"`:\n\n```rust\nfn main() {\n if lorem\n {\n println!(\"ipsum!\");\n }\n else\n {\n println!(\"dolor!\");\n }\n}\n```\n\n#### `\"ClosingNextLine\"`:\n\n```rust\nfn main() {\n if lorem {\n println!(\"ipsum!\");\n }\n else {\n println!(\"dolor!\");\n }\n}\n```",
+ "x-intellij-html-description": "Brace style for control flow constructs
\nStable: No (tracking issue: #3377)
\n"AlwaysSameLine"
(default):fn main() {\n if lorem {\n println!("ipsum!");\n } else {\n println!("dolor!");\n }\n}\n
\n"AlwaysNextLine"
:fn main() {\n if lorem\n {\n println!("ipsum!");\n }\n else\n {\n println!("dolor!");\n }\n}\n
\n"ClosingNextLine"
:fn main() {\n if lorem {\n println!("ipsum!");\n }\n else {\n println!("dolor!");\n }\n}\n
\n",
"default": "AlwaysSameLine",
- "enum": ["AlwaysSameLine", "ClosingNextLine", "AlwaysNextLine"]
+ "enum": ["AlwaysNextLine", "AlwaysSameLine", "ClosingNextLine"]
},
"disable_all_formatting": {
"type": "boolean",
- "description": "Don't reformat anything\n\n[Documentation](https://rust-lang.github.io/rustfmt/#disable_all_formatting)",
- "default": false,
- "enum": [true, false]
+ "description": "Don't reformat anything.\n\nNote that this option may be soft-deprecated in the future once the [ignore](#ignore) option is stabilized. Nightly toolchain users are encouraged to use [ignore](#ignore) instead when possible.\n\nStable: Yes",
+ "markdownDescription": "Don't reformat anything.\n\nNote that this option may be soft-deprecated in the future once the [ignore](#ignore) option is stabilized. Nightly toolchain users are encouraged to use [ignore](#ignore) instead when possible.\n\nStable: Yes",
+ "x-intellij-html-description": "Don't reformat anything.
\nNote that this option may be soft-deprecated in the future once the ignore option is stabilized. Nightly toolchain users are encouraged to use ignore instead when possible.
\nStable: Yes
\n", + "default": false }, "edition": { "type": "string", - "description": "The edition of the parser (RFC 2052)\n\n[Documentation](https://rust-lang.github.io/rustfmt/#edition)", + "description": "Specifies which edition is used by the parser.\n\nStable: Yes\n\nRustfmt is able to pick up the edition used by reading the `Cargo.toml` file if executed\nthrough the Cargo's formatting tool `cargo fmt`. Otherwise, the edition needs to be specified\nin your config file:\n\n```toml\nedition = \"2018\"\n```", + "markdownDescription": "Specifies which edition is used by the parser.\n\nStable: Yes\n\nRustfmt is able to pick up the edition used by reading the `Cargo.toml` file if executed\nthrough the Cargo's formatting tool `cargo fmt`. Otherwise, the edition needs to be specified\nin your config file:\n\n```toml\nedition = \"2018\"\n```", + "x-intellij-html-description": "Specifies which edition is used by the parser.
\nStable: Yes
\nRustfmt is able to pick up the edition used by reading the Cargo.toml
file if executed\nthrough the Cargo's formatting tool cargo fmt
. Otherwise, the edition needs to be specified\nin your config file:
edition = "2018"\n
\n",
"default": "2015",
- "enum": ["2015", "2018", "2021"]
- },
- "emit_mode": {
- "type": "string",
- "description": "What emit Mode to use when none is supplied\n\n[Documentation](https://rust-lang.github.io/rustfmt/#emit_mode)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": "Files",
- "enum": [
- "Files",
- "Stdout",
- "Coverage",
- "Checkstyle",
- "Json",
- "ModifiedLines",
- "Diff"
- ]
+ "enum": ["2015", "2018", "2021", "2024"]
},
"empty_item_single_line": {
"type": "boolean",
- "description": "Put empty-body functions and impls on a single line\n\n[Documentation](https://rust-lang.github.io/rustfmt/#empty_item_single_line)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": true,
- "enum": [true, false]
+ "description": "Put empty-body functions and impls on a single line\n\nStable: No (tracking issue: [#3356](https://github.com/rust-lang/rustfmt/issues/3356))\n\n\n#### `true` (default):\n\n```rust\nfn lorem() {}\n\nimpl Lorem {}\n```\n\n#### `false`:\n\n```rust\nfn lorem() {\n}\n\nimpl Lorem {\n}\n```\n\nSee also `brace_style`, `control_brace_style`.",
+ "markdownDescription": "Put empty-body functions and impls on a single line\n\nStable: No (tracking issue: [#3356](https://github.com/rust-lang/rustfmt/issues/3356))\n\n\n#### `true` (default):\n\n```rust\nfn lorem() {}\n\nimpl Lorem {}\n```\n\n#### `false`:\n\n```rust\nfn lorem() {\n}\n\nimpl Lorem {\n}\n```\n\nSee also `brace_style`, `control_brace_style`.",
+ "x-intellij-html-description": "Put empty-body functions and impls on a single line
\nStable: No (tracking issue: #3356)
\ntrue
(default):fn lorem() {}\n\nimpl Lorem {}\n
\nfalse
:fn lorem() {\n}\n\nimpl Lorem {\n}\n
\nSee also brace_style
, control_brace_style
.
The maximum length of enum variant having discriminant, that gets vertically aligned with others.\nVariants without discriminants would be ignored for the purpose of alignment.
\nNote that this is not how much whitespace is inserted, but instead the longest variant name that\ndoesn't get ignored when aligning.
\nPossible values: any positive integer
\nStable: No (tracking issue: #3372)
\n0
(default):enum Foo {\n A = 0,\n Bb = 1,\n RandomLongVariantGoesHere = 10,\n Ccc = 71,\n}\n\nenum Bar {\n VeryLongVariantNameHereA = 0,\n VeryLongVariantNameHereBb = 1,\n VeryLongVariantNameHereCcc = 2,\n}\n
\n20
:enum Foo {\n A = 0,\n Bb = 1,\n RandomLongVariantGoesHere = 10,\n Ccc = 2,\n}\n\nenum Bar {\n VeryLongVariantNameHereA = 0,\n VeryLongVariantNameHereBb = 1,\n VeryLongVariantNameHereCcc = 2,\n}\n
\n",
"default": 0
},
"error_on_line_overflow": {
"type": "boolean",
- "description": "Error if unable to get all lines within max_width\n\n[Documentation](https://rust-lang.github.io/rustfmt/#error_on_line_overflow)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": false,
- "enum": [true, false]
+ "description": "Error if Rustfmt is unable to get all lines within `max_width`, except for comments and string\nliterals. If this happens, then it is a bug in Rustfmt. You might be able to work around the bug by\nrefactoring your code to avoid long/complex expressions, usually by extracting a local variable or\nusing a shorter name.\n\nStable: No (tracking issue: [#3391](https://github.com/rust-lang/rustfmt/issues/3391))\n\nSee also `max_width`.",
+ "markdownDescription": "Error if Rustfmt is unable to get all lines within `max_width`, except for comments and string\nliterals. If this happens, then it is a bug in Rustfmt. You might be able to work around the bug by\nrefactoring your code to avoid long/complex expressions, usually by extracting a local variable or\nusing a shorter name.\n\nStable: No (tracking issue: [#3391](https://github.com/rust-lang/rustfmt/issues/3391))\n\nSee also `max_width`.",
+ "x-intellij-html-description": "Error if Rustfmt is unable to get all lines within max_width
, except for comments and string\nliterals. If this happens, then it is a bug in Rustfmt. You might be able to work around the bug by\nrefactoring your code to avoid long/complex expressions, usually by extracting a local variable or\nusing a shorter name.
Stable: No (tracking issue: #3391)
\nSee also max_width
.
Error if unable to get comments or string literals within max_width
, or they are left with\ntrailing whitespaces.
Stable: No (tracking issue: #3392)
\n", + "default": false }, "fn_args_layout": { "type": "string", - "description": "Control the layout of arguments in a function\n\n[Documentation](https://rust-lang.github.io/rustfmt/#fn_args_layout)", + "description": "This option is deprecated and has been renamed to `fn_params_layout` to better communicate that\nit affects the layout of parameters in function signatures.\n\nStable: Yes\n\n\n#### `\"Tall\"` (default):\n\n```rust\ntrait Lorem {\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);\n\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n ) {\n // body\n }\n}\n```\n\n#### `\"Compressed\"`:\n\n```rust\ntrait Lorem {\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);\n\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,\n adipiscing: Adipiscing, elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,\n adipiscing: Adipiscing, elit: Elit,\n ) {\n // body\n }\n}\n```\n\n#### `\"Vertical\"`:\n\n```rust\ntrait Lorem {\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n ) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n ) {\n // body\n }\n}\n```\n\nSee also `fn_params_layout`", + "markdownDescription": "This option is deprecated and has been renamed to `fn_params_layout` to better communicate that\nit affects the layout of parameters in function signatures.\n\nStable: Yes\n\n\n#### `\"Tall\"` (default):\n\n```rust\ntrait Lorem {\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);\n\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n ) {\n // body\n }\n}\n```\n\n#### `\"Compressed\"`:\n\n```rust\ntrait Lorem {\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);\n\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,\n adipiscing: Adipiscing, elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,\n adipiscing: Adipiscing, elit: Elit,\n ) {\n // body\n }\n}\n```\n\n#### `\"Vertical\"`:\n\n```rust\ntrait Lorem {\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n ) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n ) {\n // body\n }\n}\n```\n\nSee also `fn_params_layout`", + "x-intellij-html-description": "This option is deprecated and has been renamed to fn_params_layout
to better communicate that\nit affects the layout of parameters in function signatures.
Stable: Yes
\n"Tall"
(default):trait Lorem {\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);\n\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n ) {\n // body\n }\n}\n
\n"Compressed"
:trait Lorem {\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);\n\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,\n adipiscing: Adipiscing, elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,\n adipiscing: Adipiscing, elit: Elit,\n ) {\n // body\n }\n}\n
\n"Vertical"
:trait Lorem {\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n ) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n ) {\n // body\n }\n}\n
\nSee also fn_params_layout
Maximum width of the args of a function call before falling back to vertical formatting.
\nPossible values: any positive integer that is less than or equal to the value specified for max_width
Stable: Yes
\nBy default this option is set as a percentage of max_width
provided by use_small_heuristics
, but a value set directly for fn_call_width
will take precedence.
See also max_width
and use_small_heuristics
Control the layout of parameters in function signatures.
\nStable: Yes
\n"Tall"
(default):trait Lorem {\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);\n\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n ) {\n // body\n }\n}\n
\n"Compressed"
:trait Lorem {\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet);\n\n fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,\n adipiscing: Adipiscing, elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur,\n adipiscing: Adipiscing, elit: Elit,\n ) {\n // body\n }\n}\n
\n"Vertical"
:trait Lorem {\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n ) {\n // body\n }\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n );\n\n fn lorem(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n consectetur: Consectetur,\n adipiscing: Adipiscing,\n elit: Elit,\n ) {\n // body\n }\n}\n
\n",
+ "default": "Tall",
+ "enum": ["Compressed", "Tall", "Vertical"]
+ },
"fn_single_line": {
"type": "boolean",
- "description": "Put single-expression functions on a single line\n\n[Documentation](https://rust-lang.github.io/rustfmt/#fn_single_line)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": false,
- "enum": [true, false]
+ "description": "Put single-expression functions on a single line\n\nStable: No (tracking issue: [#3358](https://github.com/rust-lang/rustfmt/issues/3358))\n\n\n#### `false` (default):\n\n```rust\nfn lorem() -> usize {\n 42\n}\n\nfn lorem() -> usize {\n let ipsum = 42;\n ipsum\n}\n```\n\n#### `true`:\n\n```rust\nfn lorem() -> usize { 42 }\n\nfn lorem() -> usize {\n let ipsum = 42;\n ipsum\n}\n```\n\nSee also `control_brace_style`.",
+ "markdownDescription": "Put single-expression functions on a single line\n\nStable: No (tracking issue: [#3358](https://github.com/rust-lang/rustfmt/issues/3358))\n\n\n#### `false` (default):\n\n```rust\nfn lorem() -> usize {\n 42\n}\n\nfn lorem() -> usize {\n let ipsum = 42;\n ipsum\n}\n```\n\n#### `true`:\n\n```rust\nfn lorem() -> usize { 42 }\n\nfn lorem() -> usize {\n let ipsum = 42;\n ipsum\n}\n```\n\nSee also `control_brace_style`.",
+ "x-intellij-html-description": "Put single-expression functions on a single line
\nStable: No (tracking issue: #3358)
\nfalse
(default):fn lorem() -> usize {\n 42\n}\n\nfn lorem() -> usize {\n let ipsum = 42;\n ipsum\n}\n
\ntrue
:fn lorem() -> usize { 42 }\n\nfn lorem() -> usize {\n let ipsum = 42;\n ipsum\n}\n
\nSee also control_brace_style
.
Always print the abi for extern items
\nStable: Yes
\nNote: Non-"C" ABIs are always printed. If false
then "C" is removed.
true
(default):extern "C" {\n pub static lorem: c_int;\n}\n
\nfalse
:extern {\n pub static lorem: c_int;\n}\n
\n",
+ "default": true
},
"force_multiline_blocks": {
"type": "boolean",
- "description": "Force multiline closure bodies and match arms to be wrapped in a block\n\n[Documentation](https://rust-lang.github.io/rustfmt/#force_multiline_blocks)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": false,
- "enum": [true, false]
+ "description": "Force multiline closure and match arm bodies to be wrapped in a block\n\nStable: No (tracking issue: [#3374](https://github.com/rust-lang/rustfmt/issues/3374))\n\n\n#### `false` (default):\n\n```rust\nfn main() {\n result.and_then(|maybe_value| match maybe_value {\n None => foo(),\n Some(value) => bar(),\n });\n\n match lorem {\n None => |ipsum| {\n println!(\"Hello World\");\n },\n Some(dolor) => foo(),\n }\n}\n```\n\n#### `true`:\n\n```rust\nfn main() {\n result.and_then(|maybe_value| {\n match maybe_value {\n None => foo(),\n Some(value) => bar(),\n }\n });\n\n match lorem {\n None => {\n |ipsum| {\n println!(\"Hello World\");\n }\n }\n Some(dolor) => foo(),\n }\n}\n```",
+ "markdownDescription": "Force multiline closure and match arm bodies to be wrapped in a block\n\nStable: No (tracking issue: [#3374](https://github.com/rust-lang/rustfmt/issues/3374))\n\n\n#### `false` (default):\n\n```rust\nfn main() {\n result.and_then(|maybe_value| match maybe_value {\n None => foo(),\n Some(value) => bar(),\n });\n\n match lorem {\n None => |ipsum| {\n println!(\"Hello World\");\n },\n Some(dolor) => foo(),\n }\n}\n```\n\n#### `true`:\n\n```rust\nfn main() {\n result.and_then(|maybe_value| {\n match maybe_value {\n None => foo(),\n Some(value) => bar(),\n }\n });\n\n match lorem {\n None => {\n |ipsum| {\n println!(\"Hello World\");\n }\n }\n Some(dolor) => foo(),\n }\n}\n```",
+ "x-intellij-html-description": "Force multiline closure and match arm bodies to be wrapped in a block
\nStable: No (tracking issue: #3374)
\nfalse
(default):fn main() {\n result.and_then(|maybe_value| match maybe_value {\n None => foo(),\n Some(value) => bar(),\n });\n\n match lorem {\n None => |ipsum| {\n println!("Hello World");\n },\n Some(dolor) => foo(),\n }\n}\n
\ntrue
:fn main() {\n result.and_then(|maybe_value| {\n match maybe_value {\n None => foo(),\n Some(value) => bar(),\n }\n });\n\n match lorem {\n None => {\n |ipsum| {\n println!("Hello World");\n }\n }\n Some(dolor) => foo(),\n }\n}\n
\n",
+ "default": false
},
"format_code_in_doc_comments": {
"type": "boolean",
- "description": "Format the code snippet in doc comments.\n\n[Documentation](https://rust-lang.github.io/rustfmt/#format_code_in_doc_comments)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": false,
- "enum": [true, false]
+ "description": "Format code snippet included in doc comments.\n\nStable: No (tracking issue: [#3348](https://github.com/rust-lang/rustfmt/issues/3348))\n\n\n#### `false` (default):\n\n```rust\n/// Adds one to the number given.\n///\n/// # Examples\n///\n/// ```rust\n/// let five=5;\n///\n/// assert_eq!(\n/// 6,\n/// add_one(5)\n/// );\n/// # fn add_one(x: i32) -> i32 {\n/// # x + 1\n/// # }\n/// ```\nfn add_one(x: i32) -> i32 {\n x + 1\n}\n```\n\n#### `true`\n\n```rust\n/// Adds one to the number given.\n///\n/// # Examples\n///\n/// ```rust\n/// let five = 5;\n///\n/// assert_eq!(6, add_one(5));\n/// # fn add_one(x: i32) -> i32 {\n/// # x + 1\n/// # }\n/// ```\nfn add_one(x: i32) -> i32 {\n x + 1\n}\n```",
+ "markdownDescription": "Format code snippet included in doc comments.\n\nStable: No (tracking issue: [#3348](https://github.com/rust-lang/rustfmt/issues/3348))\n\n\n#### `false` (default):\n\n```rust\n/// Adds one to the number given.\n///\n/// # Examples\n///\n/// ```rust\n/// let five=5;\n///\n/// assert_eq!(\n/// 6,\n/// add_one(5)\n/// );\n/// # fn add_one(x: i32) -> i32 {\n/// # x + 1\n/// # }\n/// ```\nfn add_one(x: i32) -> i32 {\n x + 1\n}\n```\n\n#### `true`\n\n```rust\n/// Adds one to the number given.\n///\n/// # Examples\n///\n/// ```rust\n/// let five = 5;\n///\n/// assert_eq!(6, add_one(5));\n/// # fn add_one(x: i32) -> i32 {\n/// # x + 1\n/// # }\n/// ```\nfn add_one(x: i32) -> i32 {\n x + 1\n}\n```",
+ "x-intellij-html-description": "Format code snippet included in doc comments.
\nStable: No (tracking issue: #3348)
\nfalse
(default):/// Adds one to the number given.\n///\n/// # Examples\n///\n/// ```rust\n/// let five=5;\n///\n/// assert_eq!(\n/// 6,\n/// add_one(5)\n/// );\n/// # fn add_one(x: i32) -> i32 {\n/// # x + 1\n/// # }\n/// ```\nfn add_one(x: i32) -> i32 {\n x + 1\n}\n
\ntrue
/// Adds one to the number given.\n///\n/// # Examples\n///\n/// ```rust\n/// let five = 5;\n///\n/// assert_eq!(6, add_one(5));\n/// # fn add_one(x: i32) -> i32 {\n/// # x + 1\n/// # }\n/// ```\nfn add_one(x: i32) -> i32 {\n x + 1\n}\n
\n",
+ "default": false
+ },
+ "doc_comment_code_block_width": {
+ "type": "integer",
+ "description": "Max width for code snippets included in doc comments. Only used if `format_code_in_doc_comments` is true.\n\nPossible values: any positive integer that is less than or equal to the value specified for `max_width`\n\nStable: No (tracking issue: [#5359](https://github.com/rust-lang/rustfmt/issues/5359))",
+ "markdownDescription": "Max width for code snippets included in doc comments. Only used if `format_code_in_doc_comments` is true.\n\nPossible values: any positive integer that is less than or equal to the value specified for `max_width`\n\nStable: No (tracking issue: [#5359](https://github.com/rust-lang/rustfmt/issues/5359))",
+ "x-intellij-html-description": "Max width for code snippets included in doc comments. Only used if format_code_in_doc_comments
is true.
Possible values: any positive integer that is less than or equal to the value specified for max_width
Stable: No (tracking issue: #5359)
\n", + "default": 100 }, "format_generated_files": { "type": "boolean", - "description": "Format generated files\n\n[Documentation](https://rust-lang.github.io/rustfmt/#format_generated_files)\n\n### Unstable\nThis option requires Nightly Rust.", - "default": true, - "enum": [true, false] + "description": "Format generated files. A file is considered generated if any of the first several lines contain a `@generated` comment marker. The number of lines to check is configured by `generated_marker_line_search_limit`.\n\nBy default, generated files are reformatted, i. e. `@generated` marker is ignored.\nThis option is currently ignored for stdin (`@generated` in stdin is ignored.)\n\nStable: No (tracking issue: [#5080](https://github.com/rust-lang/rustfmt/issues/5080))", + "markdownDescription": "Format generated files. A file is considered generated if any of the first several lines contain a `@generated` comment marker. The number of lines to check is configured by `generated_marker_line_search_limit`.\n\nBy default, generated files are reformatted, i. e. `@generated` marker is ignored.\nThis option is currently ignored for stdin (`@generated` in stdin is ignored.)\n\nStable: No (tracking issue: [#5080](https://github.com/rust-lang/rustfmt/issues/5080))", + "x-intellij-html-description": "Format generated files. A file is considered generated if any of the first several lines contain a @generated
comment marker. The number of lines to check is configured by generated_marker_line_search_limit
.
By default, generated files are reformatted, i. e. @generated
marker is ignored.\nThis option is currently ignored for stdin (@generated
in stdin is ignored.)
Stable: No (tracking issue: #5080)
\n", + "default": true }, - "format_macro_bodies": { - "type": "boolean", - "description": "Format the bodies of macros\n\n[Documentation](https://rust-lang.github.io/rustfmt/#format_macro_bodies)\n\n### Unstable\nThis option requires Nightly Rust.", - "default": true, - "enum": [true, false] + "generated_marker_line_search_limit": { + "type": "integer", + "description": "Number of lines to check for a `@generated` pragma header, starting from the top of the file. Setting this value to `0` will treat all files as non-generated. When`format_generated_files` is `true`, this option has no effect.\n\nPossible values: any positive integer\n\nStable: No (tracking issue: [#5080](https://github.com/rust-lang/rustfmt/issues/5080))\n\nSee also [format_generated_files](#format_generated_files) link here.", + "markdownDescription": "Number of lines to check for a `@generated` pragma header, starting from the top of the file. Setting this value to `0` will treat all files as non-generated. When`format_generated_files` is `true`, this option has no effect.\n\nPossible values: any positive integer\n\nStable: No (tracking issue: [#5080](https://github.com/rust-lang/rustfmt/issues/5080))\n\nSee also [format_generated_files](#format_generated_files) link here.", + "x-intellij-html-description": "Number of lines to check for a @generated
pragma header, starting from the top of the file. Setting this value to 0
will treat all files as non-generated. Whenformat_generated_files
is true
, this option has no effect.
Possible values: any positive integer
\nStable: No (tracking issue: #5080)
\nSee also format_generated_files link here.
\n", + "default": 5 }, "format_macro_matchers": { "type": "boolean", - "description": "Format the metavariable matching patterns in macros\n\n[Documentation](https://rust-lang.github.io/rustfmt/#format_macro_matchers)\n\n### Unstable\nThis option requires Nightly Rust.", - "default": false, - "enum": [true, false] + "description": "Format the metavariable matching patterns in macros.\n\nStable: No (tracking issue: [#3354](https://github.com/rust-lang/rustfmt/issues/3354))\n\n\n#### `false` (default):\n\n```rust\nmacro_rules! foo {\n ($a: ident : $b: ty) => {\n $a(42): $b;\n };\n ($a: ident $b: ident $c: ident) => {\n $a = $b + $c;\n };\n}\n```\n\n#### `true`:\n\n```rust\nmacro_rules! foo {\n ($a:ident : $b:ty) => {\n $a(42): $b;\n };\n ($a:ident $b:ident $c:ident) => {\n $a = $b + $c;\n };\n}\n```\n\nSee also `format_macro_bodies`.", + "markdownDescription": "Format the metavariable matching patterns in macros.\n\nStable: No (tracking issue: [#3354](https://github.com/rust-lang/rustfmt/issues/3354))\n\n\n#### `false` (default):\n\n```rust\nmacro_rules! foo {\n ($a: ident : $b: ty) => {\n $a(42): $b;\n };\n ($a: ident $b: ident $c: ident) => {\n $a = $b + $c;\n };\n}\n```\n\n#### `true`:\n\n```rust\nmacro_rules! foo {\n ($a:ident : $b:ty) => {\n $a(42): $b;\n };\n ($a:ident $b:ident $c:ident) => {\n $a = $b + $c;\n };\n}\n```\n\nSee also `format_macro_bodies`.", + "x-intellij-html-description": "Format the metavariable matching patterns in macros.
\nStable: No (tracking issue: #3354)
\nfalse
(default):macro_rules! foo {\n ($a: ident : $b: ty) => {\n $a(42): $b;\n };\n ($a: ident $b: ident $c: ident) => {\n $a = $b + $c;\n };\n}\n
\ntrue
:macro_rules! foo {\n ($a:ident : $b:ty) => {\n $a(42): $b;\n };\n ($a:ident $b:ident $c:ident) => {\n $a = $b + $c;\n };\n}\n
\nSee also format_macro_bodies
.
Format the bodies of declarative macro definitions.
\nStable: No (tracking issue: #3355)
\ntrue
(default):macro_rules! foo {\n ($a: ident : $b: ty) => {\n $a(42): $b;\n };\n ($a: ident $b: ident $c: ident) => {\n $a = $b + $c;\n };\n}\n
\nfalse
:macro_rules! foo {\n ($a: ident : $b: ty) => { $a(42): $b; };\n ($a: ident $b: ident $c: ident) => { $a=$b+$c; };\n}\n
\nSee also format_macro_matchers
.
Skip formatting the bodies of macro invocations with the following names.
\nrustfmt will not format any macro invocation for macros with names set in this list.\nIncluding the special value "*" will prevent any macro invocations from being formatted.
\nNote: This option does not have any impact on how rustfmt formats macro definitions.
\nPossible values: a list of macro name idents, ["name_0", "name_1", ..., "*"]
Stable: No (tracking issue: #5346)
\n[]
(default):rustfmt will follow its standard approach to formatting macro invocations.
\nNo macro invocations will be skipped based on their name. More information about rustfmt's standard macro invocation formatting behavior can be found in #5437.
\nlorem!(\n const _: u8 = 0;\n);\n\nipsum!(\n const _: u8 = 0;\n);\n
\n["lorem"]
:The named macro invocations will be skipped.
\nlorem!(\n const _: u8 = 0;\n);\n\nipsum!(\n const _: u8 = 0;\n);\n
\n["*"]
:The special selector *
will skip all macro invocations.
lorem!(\n const _: u8 = 0;\n);\n\nipsum!(\n const _: u8 = 0;\n);\n
\n",
+ "default": []
+ },
+ "format_strings": {
+ "type": "boolean",
+ "description": "Format string literals where necessary\n\nStable: No (tracking issue: [#3353](https://github.com/rust-lang/rustfmt/issues/3353))\n\n\n#### `false` (default):\n\n```rust\nfn main() {\n let lorem = \"ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing\";\n}\n```\n\n#### `true`:\n\n```rust\nfn main() {\n let lorem = \"ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet \\\n consectetur adipiscing\";\n}\n```\n\nSee also `max_width`.",
+ "markdownDescription": "Format string literals where necessary\n\nStable: No (tracking issue: [#3353](https://github.com/rust-lang/rustfmt/issues/3353))\n\n\n#### `false` (default):\n\n```rust\nfn main() {\n let lorem = \"ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing\";\n}\n```\n\n#### `true`:\n\n```rust\nfn main() {\n let lorem = \"ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet \\\n consectetur adipiscing\";\n}\n```\n\nSee also `max_width`.",
+ "x-intellij-html-description": "Format string literals where necessary
\nStable: No (tracking issue: #3353)
\nfalse
(default):fn main() {\n let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet consectetur adipiscing";\n}\n
\ntrue
:fn main() {\n let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit amet \\\n consectetur adipiscing";\n}\n
\nSee also max_width
.
Use tab characters for indentation, spaces for alignment
\nStable: Yes
\nfalse
(default):fn lorem() -> usize {\n 42 // spaces before 42\n}\n
\ntrue
:fn lorem() -> usize {\n\t42 // tabs before 42\n}\n
\nSee also: tab_spaces
.
Control the case of the letters in hexadecimal literal values
\nStable: No (tracking issue: #5081)
\n", "default": "Preserve", "enum": ["Preserve", "Upper", "Lower"] }, "hide_parse_errors": { "type": "boolean", - "description": "Hide errors from the parser\n\n[Documentation](https://rust-lang.github.io/rustfmt/#hide_parse_errors)\n\n### Unstable\nThis option requires Nightly Rust.", - "default": false, - "enum": [true, false] + "description": "This option is deprecated and has been renamed to `show_parse_errors` to avoid confusion around the double negative default of `hide_parse_errors=false`.\n\nStable: No (tracking issue: [#3390](https://github.com/rust-lang/rustfmt/issues/3390))", + "markdownDescription": "This option is deprecated and has been renamed to `show_parse_errors` to avoid confusion around the double negative default of `hide_parse_errors=false`.\n\nStable: No (tracking issue: [#3390](https://github.com/rust-lang/rustfmt/issues/3390))", + "x-intellij-html-description": "This option is deprecated and has been renamed to show_parse_errors
to avoid confusion around the double negative default of hide_parse_errors=false
.
Stable: No (tracking issue: #3390)
\n", + "default": false }, - "ignore": { - "type": "array", - "description": "Skip formatting the specified files and directories\n\n[Documentation](https://rust-lang.github.io/rustfmt/#ignore)\n\n### Unstable\nThis option requires Nightly Rust.", - "default": [] + "show_parse_errors": { + "type": "boolean", + "description": "Show parse errors if the parser failed to parse files.\n\nStable: No (tracking issue: [#5977](https://github.com/rust-lang/rustfmt/issues/5977))", + "markdownDescription": "Show parse errors if the parser failed to parse files.\n\nStable: No (tracking issue: [#5977](https://github.com/rust-lang/rustfmt/issues/5977))", + "x-intellij-html-description": "Show parse errors if the parser failed to parse files.
\nStable: No (tracking issue: #5977)
\n", + "default": true }, - "imports_granularity": { - "type": "string", - "description": "Merge or split imports to the provided granularity\n\n[Documentation](https://rust-lang.github.io/rustfmt/#imports_granularity)\n\n### Unstable\nThis option requires Nightly Rust.", - "default": "Preserve", - "enum": ["Preserve", "Crate", "Module", "Item", "One"] + "ignore": { + "description": "Skip formatting files and directories that match the specified pattern.\nThe pattern format is the same as [.gitignore](https://git-scm.com/docs/gitignore#_pattern_format). Be sure to use Unix/forwardslash `/` style paths. This path style will work on all platforms. Windows style paths with backslashes `\\` are not supported.\n\nDefault value: format every file\n\nPossible values: See an example below\n\nStable: No (tracking issue: [#3395](https://github.com/rust-lang/rustfmt/issues/3395))\n\n\n### Example\n\nIf you want to ignore specific files, put the following to your config file:\n\n```toml\nignore = [\n \"src/types.rs\",\n \"src/foo/bar.rs\",\n]\n```\n\nIf you want to ignore every file under `examples/`, put the following to your config file:\n\n```toml\nignore = [\n \"examples\",\n]\n```\n\nIf you want to ignore every file under the directory where you put your rustfmt.toml:\n\n```toml\nignore = [\"/\"]\n```\n\nIf you want to allow specific paths that would otherwise be ignored, prefix those paths with a `!`:\n\n```toml\nignore = [\"bar_dir/*\", \"!bar_dir/*/what.rs\"]\n```\n\nIn this case, all files under `bar_dir` will be ignored, except files like `bar_dir/sub/what.rs`\nor `bar_dir/another/what.rs`.", + "markdownDescription": "Skip formatting files and directories that match the specified pattern.\nThe pattern format is the same as [.gitignore](https://git-scm.com/docs/gitignore#_pattern_format). Be sure to use Unix/forwardslash `/` style paths. This path style will work on all platforms. Windows style paths with backslashes `\\` are not supported.\n\nDefault value: format every file\n\nPossible values: See an example below\n\nStable: No (tracking issue: [#3395](https://github.com/rust-lang/rustfmt/issues/3395))\n\n\n### Example\n\nIf you want to ignore specific files, put the following to your config file:\n\n```toml\nignore = [\n \"src/types.rs\",\n \"src/foo/bar.rs\",\n]\n```\n\nIf you want to ignore every file under `examples/`, put the following to your config file:\n\n```toml\nignore = [\n \"examples\",\n]\n```\n\nIf you want to ignore every file under the directory where you put your rustfmt.toml:\n\n```toml\nignore = [\"/\"]\n```\n\nIf you want to allow specific paths that would otherwise be ignored, prefix those paths with a `!`:\n\n```toml\nignore = [\"bar_dir/*\", \"!bar_dir/*/what.rs\"]\n```\n\nIn this case, all files under `bar_dir` will be ignored, except files like `bar_dir/sub/what.rs`\nor `bar_dir/another/what.rs`.", + "x-intellij-html-description": "Skip formatting files and directories that match the specified pattern.\nThe pattern format is the same as .gitignore. Be sure to use Unix/forwardslash /
style paths. This path style will work on all platforms. Windows style paths with backslashes \\
are not supported.
Default value: format every file
\nPossible values: See an example below
\nStable: No (tracking issue: #3395)
\nIf you want to ignore specific files, put the following to your config file:
\nignore = [\n "src/types.rs",\n "src/foo/bar.rs",\n]\n
\nIf you want to ignore every file under examples/
, put the following to your config file:
ignore = [\n "examples",\n]\n
\nIf you want to ignore every file under the directory where you put your rustfmt.toml:
\nignore = ["/"]\n
\nIf you want to allow specific paths that would otherwise be ignored, prefix those paths with a !
:
ignore = ["bar_dir/*", "!bar_dir/*/what.rs"]\n
\nIn this case, all files under bar_dir
will be ignored, except files like bar_dir/sub/what.rs
\nor bar_dir/another/what.rs
.
Indent style of imports
\nStable: No (tracking issue: #3360)
\n"Block"
(default):use foo::{\n xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,\n zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz,\n};\n
\n"Visual"
:use foo::{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy,\n zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz};\n
\nSee also: imports_layout
.
Item layout inside a imports block
\nStable: No (tracking issue: #3361)
\n"Mixed"
(default):use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};\n\nuse foo::{\n aaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb, cccccccccccccccccc, dddddddddddddddddd,\n eeeeeeeeeeeeeeeeee, ffffffffffffffffff,\n};\n
\n"Horizontal"
:Note: This option forces all imports onto one line and may exceed max_width
.
use foo::{xxx, yyy, zzz};\n\nuse foo::{aaa, bbb, ccc, ddd, eee, fff};\n
\n"HorizontalVertical"
:use foo::{xxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzzzz};\n\nuse foo::{\n aaaaaaaaaaaaaaaaaa,\n bbbbbbbbbbbbbbbbbb,\n cccccccccccccccccc,\n dddddddddddddddddd,\n eeeeeeeeeeeeeeeeee,\n ffffffffffffffffff,\n};\n
\n"Vertical"
:use foo::{\n xxx,\n yyy,\n zzz,\n};\n\nuse foo::{\n aaa,\n bbb,\n ccc,\n ddd,\n eee,\n fff,\n};\n
\n",
"default": "Mixed",
- "enum": [
- "Vertical",
- "Horizontal",
- "HorizontalVertical",
- "LimitedHorizontalVertical",
- "Mixed"
- ]
+ "enum": ["Horizontal", "HorizontalVertical", "Mixed", "Vertical"]
},
"indent_style": {
"type": "string",
- "description": "How do we indent expressions or items\n\n[Documentation](https://rust-lang.github.io/rustfmt/#indent_style)\n\n### Unstable\nThis option requires Nightly Rust.",
+ "description": "Indent on expressions or items.\n\nStable: No (tracking issue: [#3346](https://github.com/rust-lang/rustfmt/issues/3346))\n\n\n### Array\n\n#### `\"Block\"` (default):\n\n```rust\nfn main() {\n let lorem = vec![\n \"ipsum\",\n \"dolor\",\n \"sit\",\n \"amet\",\n \"consectetur\",\n \"adipiscing\",\n \"elit\",\n ];\n}\n```\n\n#### `\"Visual\"`:\n\n```rust\nfn main() {\n let lorem = vec![\"ipsum\",\n \"dolor\",\n \"sit\",\n \"amet\",\n \"consectetur\",\n \"adipiscing\",\n \"elit\"];\n}\n```\n\n### Control flow\n\n#### `\"Block\"` (default):\n\n```rust\nfn main() {\n if lorem_ipsum\n && dolor_sit\n && amet_consectetur\n && lorem_sit\n && dolor_consectetur\n && amet_ipsum\n && lorem_consectetur\n {\n // ...\n }\n}\n```\n\n#### `\"Visual\"`:\n\n```rust\nfn main() {\n if lorem_ipsum\n && dolor_sit\n && amet_consectetur\n && lorem_sit\n && dolor_consectetur\n && amet_ipsum\n && lorem_consectetur\n {\n // ...\n }\n}\n```\n\nSee also: `control_brace_style`.\n\n### Function arguments\n\n#### `\"Block\"` (default):\n\n```rust\nfn lorem() {}\n\nfn lorem(ipsum: usize) {}\n\nfn lorem(\n ipsum: usize,\n dolor: usize,\n sit: usize,\n amet: usize,\n consectetur: usize,\n adipiscing: usize,\n elit: usize,\n) {\n // body\n}\n```\n\n#### `\"Visual\"`:\n\n```rust\nfn lorem() {}\n\nfn lorem(ipsum: usize) {}\n\nfn lorem(ipsum: usize,\n dolor: usize,\n sit: usize,\n amet: usize,\n consectetur: usize,\n adipiscing: usize,\n elit: usize) {\n // body\n}\n```\n\n### Function calls\n\n#### `\"Block\"` (default):\n\n```rust\nfn main() {\n lorem(\n \"lorem\",\n \"ipsum\",\n \"dolor\",\n \"sit\",\n \"amet\",\n \"consectetur\",\n \"adipiscing\",\n \"elit\",\n );\n}\n```\n\n#### `\"Visual\"`:\n\n```rust\nfn main() {\n lorem(\"lorem\",\n \"ipsum\",\n \"dolor\",\n \"sit\",\n \"amet\",\n \"consectetur\",\n \"adipiscing\",\n \"elit\");\n}\n```\n\n### Generics\n\n#### `\"Block\"` (default):\n\n```rust\nfn lorem<\n Ipsum: Eq = usize,\n Dolor: Eq = usize,\n Sit: Eq = usize,\n Amet: Eq = usize,\n Adipiscing: Eq = usize,\n Consectetur: Eq = usize,\n Elit: Eq = usize,\n>(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n adipiscing: Adipiscing,\n consectetur: Consectetur,\n elit: Elit,\n) -> T {\n // body\n}\n```\n\n#### `\"Visual\"`:\n\n```rust\nfn loremIndent on expressions or items.
\nStable: No (tracking issue: #3346)
\n"Block"
(default):fn main() {\n let lorem = vec![\n "ipsum",\n "dolor",\n "sit",\n "amet",\n "consectetur",\n "adipiscing",\n "elit",\n ];\n}\n
\n"Visual"
:fn main() {\n let lorem = vec!["ipsum",\n "dolor",\n "sit",\n "amet",\n "consectetur",\n "adipiscing",\n "elit"];\n}\n
\n"Block"
(default):fn main() {\n if lorem_ipsum\n && dolor_sit\n && amet_consectetur\n && lorem_sit\n && dolor_consectetur\n && amet_ipsum\n && lorem_consectetur\n {\n // ...\n }\n}\n
\n"Visual"
:fn main() {\n if lorem_ipsum\n && dolor_sit\n && amet_consectetur\n && lorem_sit\n && dolor_consectetur\n && amet_ipsum\n && lorem_consectetur\n {\n // ...\n }\n}\n
\nSee also: control_brace_style
.
"Block"
(default):fn lorem() {}\n\nfn lorem(ipsum: usize) {}\n\nfn lorem(\n ipsum: usize,\n dolor: usize,\n sit: usize,\n amet: usize,\n consectetur: usize,\n adipiscing: usize,\n elit: usize,\n) {\n // body\n}\n
\n"Visual"
:fn lorem() {}\n\nfn lorem(ipsum: usize) {}\n\nfn lorem(ipsum: usize,\n dolor: usize,\n sit: usize,\n amet: usize,\n consectetur: usize,\n adipiscing: usize,\n elit: usize) {\n // body\n}\n
\n"Block"
(default):fn main() {\n lorem(\n "lorem",\n "ipsum",\n "dolor",\n "sit",\n "amet",\n "consectetur",\n "adipiscing",\n "elit",\n );\n}\n
\n"Visual"
:fn main() {\n lorem("lorem",\n "ipsum",\n "dolor",\n "sit",\n "amet",\n "consectetur",\n "adipiscing",\n "elit");\n}\n
\n"Block"
(default):fn lorem<\n Ipsum: Eq = usize,\n Dolor: Eq = usize,\n Sit: Eq = usize,\n Amet: Eq = usize,\n Adipiscing: Eq = usize,\n Consectetur: Eq = usize,\n Elit: Eq = usize,\n>(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n adipiscing: Adipiscing,\n consectetur: Consectetur,\n elit: Elit,\n) -> T {\n // body\n}\n
\n"Visual"
:fn lorem<Ipsum: Eq = usize,\n Dolor: Eq = usize,\n Sit: Eq = usize,\n Amet: Eq = usize,\n Adipiscing: Eq = usize,\n Consectetur: Eq = usize,\n Elit: Eq = usize>(\n ipsum: Ipsum,\n dolor: Dolor,\n sit: Sit,\n amet: Amet,\n adipiscing: Adipiscing,\n consectetur: Consectetur,\n elit: Elit)\n -> T {\n // body\n}\n
\n"Block"
(default):fn main() {\n let lorem = Lorem {\n ipsum: dolor,\n sit: amet,\n };\n}\n
\n"Visual"
:fn main() {\n let lorem = Lorem { ipsum: dolor,\n sit: amet };\n}\n
\nSee also: struct_lit_single_line
, indent_style
.
"Block"
(default):fn lorem<Ipsum, Dolor, Sit, Amet>() -> T\nwhere\n Ipsum: Eq,\n Dolor: Eq,\n Sit: Eq,\n Amet: Eq,\n{\n // body\n}\n
\n"Visual"
:fn lorem<Ipsum, Dolor, Sit, Amet>() -> T\n where Ipsum: Eq,\n Dolor: Eq,\n Sit: Eq,\n Amet: Eq\n{\n // body\n}\n
\n",
"default": "Block",
- "enum": ["Visual", "Block"]
+ "enum": ["Block", "Visual"]
},
"inline_attribute_width": {
"type": "integer",
- "description": "Write an item and its attribute on the same line if their combined width is below a threshold\n\n[Documentation](https://rust-lang.github.io/rustfmt/#inline_attribute_width)\n\n### Unstable\nThis option requires Nightly Rust.",
+ "description": "Write an item and its attribute on the same line if their combined width is below a threshold\n\nPossible values: any positive integer\n\nStable: No (tracking issue: [#3343](https://github.com/rust-lang/rustfmt/issues/3343))\n\n\n### Example\n\n#### `0` (default):\n```rust\n#[cfg(feature = \"alloc\")]\nuse core::slice;\n```\n\n#### `50`:\n```rust\n#[cfg(feature = \"alloc\")] use core::slice;\n```",
+ "markdownDescription": "Write an item and its attribute on the same line if their combined width is below a threshold\n\nPossible values: any positive integer\n\nStable: No (tracking issue: [#3343](https://github.com/rust-lang/rustfmt/issues/3343))\n\n\n### Example\n\n#### `0` (default):\n```rust\n#[cfg(feature = \"alloc\")]\nuse core::slice;\n```\n\n#### `50`:\n```rust\n#[cfg(feature = \"alloc\")] use core::slice;\n```",
+ "x-intellij-html-description": "Write an item and its attribute on the same line if their combined width is below a threshold
\nPossible values: any positive integer
\nStable: No (tracking issue: #3343)
\n0
(default):#[cfg(feature = "alloc")]\nuse core::slice;\n
\n50
:#[cfg(feature = "alloc")] use core::slice;\n
\n",
"default": 0
},
- "license_template_path": {
- "type": "string",
- "description": "Beginning of file must match license template\n\n[Documentation](https://rust-lang.github.io/rustfmt/#license_template_path)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": "\"\""
- },
- "make_backup": {
- "type": "boolean",
- "description": "Backup changed files\n\n[Documentation](https://rust-lang.github.io/rustfmt/#make_backup)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": false,
- "enum": [true, false]
- },
"match_arm_blocks": {
"type": "boolean",
- "description": "Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms\n\n[Documentation](https://rust-lang.github.io/rustfmt/#match_arm_blocks)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": true,
- "enum": [true, false]
+ "description": "Controls whether arm bodies are wrapped in cases where the first line of the body cannot fit on the same line as the `=>` operator.\n\nThe Style Guide requires that bodies are block wrapped by default if a line break is required after the `=>`, but this option can be used to disable that behavior to prevent wrapping arm bodies in that event, so long as the body contains neither multiple statements nor line comments.\n\nStable: No (tracking issue: [#3373](https://github.com/rust-lang/rustfmt/issues/3373))\n\n\n#### `true` (default):\n\n```rust\nfn main() {\n match lorem {\n ipsum => {\n foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)\n }\n dolor => println!(\"{}\", sit),\n sit => foo(\n \"foooooooooooooooooooooooo\",\n \"baaaaaaaaaaaaaaaaaaaaaaaarr\",\n \"baaaaaaaaaaaaaaaaaaaazzzzzzzzzzzzz\",\n \"qqqqqqqqquuuuuuuuuuuuuuuuuuuuuuuuuuxxx\",\n ),\n }\n}\n```\n\n#### `false`:\n\n```rust\nfn main() {\n match lorem {\n lorem =>\n foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),\n ipsum => println!(\"{}\", sit),\n sit => foo(\n \"foooooooooooooooooooooooo\",\n \"baaaaaaaaaaaaaaaaaaaaaaaarr\",\n \"baaaaaaaaaaaaaaaaaaaazzzzzzzzzzzzz\",\n \"qqqqqqqqquuuuuuuuuuuuuuuuuuuuuuuuuuxxx\",\n ),\n }\n}\n```\n\nSee also: `match_block_trailing_comma`.",
+ "markdownDescription": "Controls whether arm bodies are wrapped in cases where the first line of the body cannot fit on the same line as the `=>` operator.\n\nThe Style Guide requires that bodies are block wrapped by default if a line break is required after the `=>`, but this option can be used to disable that behavior to prevent wrapping arm bodies in that event, so long as the body contains neither multiple statements nor line comments.\n\nStable: No (tracking issue: [#3373](https://github.com/rust-lang/rustfmt/issues/3373))\n\n\n#### `true` (default):\n\n```rust\nfn main() {\n match lorem {\n ipsum => {\n foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)\n }\n dolor => println!(\"{}\", sit),\n sit => foo(\n \"foooooooooooooooooooooooo\",\n \"baaaaaaaaaaaaaaaaaaaaaaaarr\",\n \"baaaaaaaaaaaaaaaaaaaazzzzzzzzzzzzz\",\n \"qqqqqqqqquuuuuuuuuuuuuuuuuuuuuuuuuuxxx\",\n ),\n }\n}\n```\n\n#### `false`:\n\n```rust\nfn main() {\n match lorem {\n lorem =>\n foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),\n ipsum => println!(\"{}\", sit),\n sit => foo(\n \"foooooooooooooooooooooooo\",\n \"baaaaaaaaaaaaaaaaaaaaaaaarr\",\n \"baaaaaaaaaaaaaaaaaaaazzzzzzzzzzzzz\",\n \"qqqqqqqqquuuuuuuuuuuuuuuuuuuuuuuuuuxxx\",\n ),\n }\n}\n```\n\nSee also: `match_block_trailing_comma`.",
+ "x-intellij-html-description": "Controls whether arm bodies are wrapped in cases where the first line of the body cannot fit on the same line as the =>
operator.
The Style Guide requires that bodies are block wrapped by default if a line break is required after the =>
, but this option can be used to disable that behavior to prevent wrapping arm bodies in that event, so long as the body contains neither multiple statements nor line comments.
Stable: No (tracking issue: #3373)
\ntrue
(default):fn main() {\n match lorem {\n ipsum => {\n foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x)\n }\n dolor => println!("{}", sit),\n sit => foo(\n "foooooooooooooooooooooooo",\n "baaaaaaaaaaaaaaaaaaaaaaaarr",\n "baaaaaaaaaaaaaaaaaaaazzzzzzzzzzzzz",\n "qqqqqqqqquuuuuuuuuuuuuuuuuuuuuuuuuuxxx",\n ),\n }\n}\n
\nfalse
:fn main() {\n match lorem {\n lorem =>\n foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(x),\n ipsum => println!("{}", sit),\n sit => foo(\n "foooooooooooooooooooooooo",\n "baaaaaaaaaaaaaaaaaaaaaaaarr",\n "baaaaaaaaaaaaaaaaaaaazzzzzzzzzzzzz",\n "qqqqqqqqquuuuuuuuuuuuuuuuuuuuuuuuuuxxx",\n ),\n }\n}\n
\nSee also: match_block_trailing_comma
.
Controls whether to include a leading pipe on match arms
\nStable: Yes
\nNever
(default):// Leading pipes are removed from this:\n// fn foo() {\n// match foo {\n// | "foo" | "bar" => {}\n// | "baz"\n// | "something relatively long"\n// | "something really really really realllllllllllllly long" => println!("x"),\n// | "qux" => println!("y"),\n// _ => {}\n// }\n// }\n\n// Becomes\nfn foo() {\n match foo {\n "foo" | "bar" => {}\n "baz"\n | "something relatively long"\n | "something really really really realllllllllllllly long" => println!("x"),\n "qux" => println!("y"),\n _ => {}\n }\n}\n
\nAlways
:// Leading pipes are emitted on all arms of this:\n// fn foo() {\n// match foo {\n// "foo" | "bar" => {}\n// "baz"\n// | "something relatively long"\n// | "something really really really realllllllllllllly long" => println!("x"),\n// "qux" => println!("y"),\n// _ => {}\n// }\n// }\n\n// Becomes:\nfn foo() {\n match foo {\n | "foo" | "bar" => {}\n | "baz"\n | "something relatively long"\n | "something really really really realllllllllllllly long" => println!("x"),\n | "qux" => println!("y"),\n | _ => {}\n }\n}\n
\nPreserve
:fn foo() {\n match foo {\n | "foo" | "bar" => {}\n | "baz"\n | "something relatively long"\n | "something really really really realllllllllllllly long" => println!("x"),\n | "qux" => println!("y"),\n _ => {}\n }\n\n match baz {\n "qux" => {}\n "foo" | "bar" => {}\n _ => {}\n }\n}\n
\n",
"default": "Never",
"enum": ["Always", "Never", "Preserve"]
},
"match_block_trailing_comma": {
"type": "boolean",
- "description": "Put a trailing comma after a block based match arm (non-block arms are not affected)\n\n[Documentation](https://rust-lang.github.io/rustfmt/#match_block_trailing_comma)",
- "default": false,
- "enum": [true, false]
+ "description": "Put a trailing comma after a block based match arm (non-block arms are not affected)\n\nStable: Yes\n\n\n#### `false` (default):\n\n```rust\nfn main() {\n match lorem {\n Lorem::Ipsum => {\n println!(\"ipsum\");\n }\n Lorem::Dolor => println!(\"dolor\"),\n }\n}\n```\n\n#### `true`:\n\n```rust\nfn main() {\n match lorem {\n Lorem::Ipsum => {\n println!(\"ipsum\");\n },\n Lorem::Dolor => println!(\"dolor\"),\n }\n}\n```\n\nSee also: `trailing_comma`, `match_arm_blocks`.",
+ "markdownDescription": "Put a trailing comma after a block based match arm (non-block arms are not affected)\n\nStable: Yes\n\n\n#### `false` (default):\n\n```rust\nfn main() {\n match lorem {\n Lorem::Ipsum => {\n println!(\"ipsum\");\n }\n Lorem::Dolor => println!(\"dolor\"),\n }\n}\n```\n\n#### `true`:\n\n```rust\nfn main() {\n match lorem {\n Lorem::Ipsum => {\n println!(\"ipsum\");\n },\n Lorem::Dolor => println!(\"dolor\"),\n }\n}\n```\n\nSee also: `trailing_comma`, `match_arm_blocks`.",
+ "x-intellij-html-description": "Put a trailing comma after a block based match arm (non-block arms are not affected)
\nStable: Yes
\nfalse
(default):fn main() {\n match lorem {\n Lorem::Ipsum => {\n println!("ipsum");\n }\n Lorem::Dolor => println!("dolor"),\n }\n}\n
\ntrue
:fn main() {\n match lorem {\n Lorem::Ipsum => {\n println!("ipsum");\n },\n Lorem::Dolor => println!("dolor"),\n }\n}\n
\nSee also: trailing_comma
, match_arm_blocks
.
Maximum width of each line
\nPossible values: any positive integer
\nStable: Yes
\nSee also error_on_line_overflow
.
Merge multiple derives into a single one.
\nStable: Yes
\ntrue
(default):#[derive(Eq, PartialEq, Debug, Copy, Clone)]\npub enum Foo {}\n
\nfalse
:#[derive(Eq, PartialEq, Debug, Copy, Clone)]\npub enum Bar {}\n\n#[derive(Eq, PartialEq)]\n#[derive(Debug)]\n#[derive(Copy, Clone)]\npub enum Foo {}\n
\n",
+ "default": true
+ },
+ "imports_granularity": {
+ "type": "string",
+ "description": "Controls how imports are structured in `use` statements. Imports will be merged or split to the configured level of granularity.\n\nSimilar to other `import` related configuration options, this option operates within the bounds of user-defined groups of imports. See `group_imports` for more information on import groups.\n\nNote that rustfmt will not modify the granularity of imports containing comments if doing so could potentially lose or misplace said comments.\n\nStable: No (tracking issue: [#4991](https://github.com/rust-lang/rustfmt/issues/4991))\n\n\n#### `Preserve` (default):\n\nDo not change the granularity of any imports and preserve the original structure written by the developer.\n\n```rust\nuse foo::b;\nuse foo::b::{f, g};\nuse foo::{a, c, d::e};\nuse qux::{h, i};\n```\n\n#### `Crate`:\n\nMerge imports from the same crate into a single `use` statement. Conversely, imports from different crates are split into separate statements.\n\n```rust\nuse foo::{\n a, b,\n b::{f, g},\n c,\n d::e,\n};\nuse qux::{h, i};\n```\n\n#### `Module`:\n\nMerge imports from the same module into a single `use` statement. Conversely, imports from different modules are split into separate statements.\n\n```rust\nuse foo::b::{f, g};\nuse foo::d::e;\nuse foo::{a, b, c};\nuse qux::{h, i};\n```\n\n#### `Item`:\n\nFlatten imports so that each has its own `use` statement.\n\n```rust\nuse foo::a;\nuse foo::b;\nuse foo::b::f;\nuse foo::b::g;\nuse foo::c;\nuse foo::d::e;\nuse qux::h;\nuse qux::i;\n```\n\n#### `One`:\n\nMerge all imports into a single `use` statement as long as they have the same visibility.\n\n```rust\npub use foo::{x, y};\nuse {\n bar::{\n a,\n b::{self, f, g},\n c,\n d::e,\n },\n qux::{h, i},\n};\n```",
+ "markdownDescription": "Controls how imports are structured in `use` statements. Imports will be merged or split to the configured level of granularity.\n\nSimilar to other `import` related configuration options, this option operates within the bounds of user-defined groups of imports. See `group_imports` for more information on import groups.\n\nNote that rustfmt will not modify the granularity of imports containing comments if doing so could potentially lose or misplace said comments.\n\nStable: No (tracking issue: [#4991](https://github.com/rust-lang/rustfmt/issues/4991))\n\n\n#### `Preserve` (default):\n\nDo not change the granularity of any imports and preserve the original structure written by the developer.\n\n```rust\nuse foo::b;\nuse foo::b::{f, g};\nuse foo::{a, c, d::e};\nuse qux::{h, i};\n```\n\n#### `Crate`:\n\nMerge imports from the same crate into a single `use` statement. Conversely, imports from different crates are split into separate statements.\n\n```rust\nuse foo::{\n a, b,\n b::{f, g},\n c,\n d::e,\n};\nuse qux::{h, i};\n```\n\n#### `Module`:\n\nMerge imports from the same module into a single `use` statement. Conversely, imports from different modules are split into separate statements.\n\n```rust\nuse foo::b::{f, g};\nuse foo::d::e;\nuse foo::{a, b, c};\nuse qux::{h, i};\n```\n\n#### `Item`:\n\nFlatten imports so that each has its own `use` statement.\n\n```rust\nuse foo::a;\nuse foo::b;\nuse foo::b::f;\nuse foo::b::g;\nuse foo::c;\nuse foo::d::e;\nuse qux::h;\nuse qux::i;\n```\n\n#### `One`:\n\nMerge all imports into a single `use` statement as long as they have the same visibility.\n\n```rust\npub use foo::{x, y};\nuse {\n bar::{\n a,\n b::{self, f, g},\n c,\n d::e,\n },\n qux::{h, i},\n};\n```",
+ "x-intellij-html-description": "Controls how imports are structured in use
statements. Imports will be merged or split to the configured level of granularity.
Similar to other import
related configuration options, this option operates within the bounds of user-defined groups of imports. See group_imports
for more information on import groups.
Note that rustfmt will not modify the granularity of imports containing comments if doing so could potentially lose or misplace said comments.
\nStable: No (tracking issue: #4991)
\nPreserve
(default):Do not change the granularity of any imports and preserve the original structure written by the developer.
\nuse foo::b;\nuse foo::b::{f, g};\nuse foo::{a, c, d::e};\nuse qux::{h, i};\n
\nCrate
:Merge imports from the same crate into a single use
statement. Conversely, imports from different crates are split into separate statements.
use foo::{\n a, b,\n b::{f, g},\n c,\n d::e,\n};\nuse qux::{h, i};\n
\nModule
:Merge imports from the same module into a single use
statement. Conversely, imports from different modules are split into separate statements.
use foo::b::{f, g};\nuse foo::d::e;\nuse foo::{a, b, c};\nuse qux::{h, i};\n
\nItem
:Flatten imports so that each has its own use
statement.
use foo::a;\nuse foo::b;\nuse foo::b::f;\nuse foo::b::g;\nuse foo::c;\nuse foo::d::e;\nuse qux::h;\nuse qux::i;\n
\nOne
:Merge all imports into a single use
statement as long as they have the same visibility.
pub use foo::{x, y};\nuse {\n bar::{\n a,\n b::{self, f, g},\n c,\n d::e,\n },\n qux::{h, i},\n};\n
\n",
+ "default": "Preserve",
+ "enum": ["Preserve", "Crate", "Module", "Item", "One"]
},
- "newline_style": {
+ "merge_imports": {
"type": "string",
- "description": "Unix or Windows line endings\n\n[Documentation](https://rust-lang.github.io/rustfmt/#newline_style)",
+ "description": "This option is deprecated. Use `imports_granularity = \"Crate\"` instead.\n\n- **Default value**: `false`\n- **Possible values**: `true`, `false`\n\n#### `false` (default):\n\n```rust\nuse foo::{a, c, d};\nuse foo::{b, g};\nuse foo::{e, f};\n```\n\n#### `true`:\n\n```rust\nuse foo::{a, b, c, d, e, f, g};\n```\n\n\n## `newline_style`\n\nUnix or Windows line endings\n\nStable: Yes\n\n\n#### `Auto` (default):\n\nThe newline style is detected automatically on a per-file basis. Files\nwith mixed line endings will be converted to the first detected line\nending style.\n\n#### `Native`\n\nLine endings will be converted to `\\r\\n` on Windows and `\\n` on all\nother platforms.\n\n#### `Unix`\n\nLine endings will be converted to `\\n`.\n\n#### `Windows`\n\nLine endings will be converted to `\\r\\n`.",
+ "markdownDescription": "This option is deprecated. Use `imports_granularity = \"Crate\"` instead.\n\n- **Default value**: `false`\n- **Possible values**: `true`, `false`\n\n#### `false` (default):\n\n```rust\nuse foo::{a, c, d};\nuse foo::{b, g};\nuse foo::{e, f};\n```\n\n#### `true`:\n\n```rust\nuse foo::{a, b, c, d, e, f, g};\n```\n\n\n## `newline_style`\n\nUnix or Windows line endings\n\nStable: Yes\n\n\n#### `Auto` (default):\n\nThe newline style is detected automatically on a per-file basis. Files\nwith mixed line endings will be converted to the first detected line\nending style.\n\n#### `Native`\n\nLine endings will be converted to `\\r\\n` on Windows and `\\n` on all\nother platforms.\n\n#### `Unix`\n\nLine endings will be converted to `\\n`.\n\n#### `Windows`\n\nLine endings will be converted to `\\r\\n`.",
+ "x-intellij-html-description": "This option is deprecated. Use imports_granularity = "Crate"
instead.
false
true
, false
false
(default):use foo::{a, c, d};\nuse foo::{b, g};\nuse foo::{e, f};\n
\ntrue
:use foo::{a, b, c, d, e, f, g};\n
\nnewline_style
Unix or Windows line endings
\nStable: Yes
\nAuto
(default):The newline style is detected automatically on a per-file basis. Files\nwith mixed line endings will be converted to the first detected line\nending style.
\nNative
Line endings will be converted to \\r\\n
on Windows and \\n
on all\nother platforms.
Unix
Line endings will be converted to \\n
.
Windows
Line endings will be converted to \\r\\n
.
Convert /* */ comments to // comments where possible
\nStable: No (tracking issue: #3350)
\nfalse
(default):// Lorem ipsum:\nfn dolor() -> usize {}\n\n/* sit amet: */\nfn adipiscing() -> usize {}\n
\ntrue
:// Lorem ipsum:\nfn dolor() -> usize {}\n\n// sit amet:\nfn adipiscing() -> usize {}\n
\n",
+ "default": false
},
"normalize_doc_attributes": {
"type": "boolean",
- "description": "Normalize doc attributes as doc comments\n\n[Documentation](https://rust-lang.github.io/rustfmt/#normalize_doc_attributes)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": false,
- "enum": [true, false]
+ "description": "Convert `#![doc]` and `#[doc]` attributes to `//!` and `///` doc comments.\n\nStable: No (tracking issue: [#3351](https://github.com/rust-lang/rustfmt/issues/3351))\n\n\n#### `false` (default):\n\n```rust\n#![doc = \"Example documentation\"]\n\n#[doc = \"Example item documentation\"]\npub enum Bar {}\n\n/// Example item documentation\npub enum Foo {}\n```\n\n#### `true`:\n\n```rust\n//! Example documentation\n\n/// Example item documentation\npub enum Foo {}\n```",
+ "markdownDescription": "Convert `#![doc]` and `#[doc]` attributes to `//!` and `///` doc comments.\n\nStable: No (tracking issue: [#3351](https://github.com/rust-lang/rustfmt/issues/3351))\n\n\n#### `false` (default):\n\n```rust\n#![doc = \"Example documentation\"]\n\n#[doc = \"Example item documentation\"]\npub enum Bar {}\n\n/// Example item documentation\npub enum Foo {}\n```\n\n#### `true`:\n\n```rust\n//! Example documentation\n\n/// Example item documentation\npub enum Foo {}\n```",
+ "x-intellij-html-description": "Convert #![doc]
and #[doc]
attributes to //!
and ///
doc comments.
Stable: No (tracking issue: #3351)
\nfalse
(default):#![doc = "Example documentation"]\n\n#[doc = "Example item documentation"]\npub enum Bar {}\n\n/// Example item documentation\npub enum Foo {}\n
\ntrue
://! Example documentation\n\n/// Example item documentation\npub enum Foo {}\n
\n",
+ "default": false
},
"overflow_delimited_expr": {
"type": "boolean",
- "description": "Allow trailing bracket/brace delimited expressions to overflow\n\n[Documentation](https://rust-lang.github.io/rustfmt/#overflow_delimited_expr)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": false,
- "enum": [true, false]
- },
- "print_misformatted_file_names": {
- "type": "boolean",
- "description": "Prints the names of mismatched files that were formatted. Prints the names of files that would be formatted when used with `--check` mode.\n\n[Documentation](https://rust-lang.github.io/rustfmt/#print_misformatted_file_names)",
- "default": false,
- "enum": [true, false]
+ "description": "When structs, slices, arrays, and block/array-like macros are used as the last\nargument in an expression list, allow them to overflow (like blocks/closures)\ninstead of being indented on a new line.\n\nStable: No (tracking issue: [#3370](https://github.com/rust-lang/rustfmt/issues/3370))\n\n\n#### `false` (default):\n\n```rust\nfn example() {\n foo(ctx, |param| {\n action();\n foo(param)\n });\n\n foo(\n ctx,\n Bar {\n x: value,\n y: value2,\n },\n );\n\n foo(\n ctx,\n &[\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ],\n );\n\n foo(\n ctx,\n vec![\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ],\n );\n}\n```\n\n#### `true`:\n\n```rust\nfn example() {\n foo(ctx, |param| {\n action();\n foo(param)\n });\n\n foo(ctx, Bar {\n x: value,\n y: value2,\n });\n\n foo(ctx, &[\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ]);\n\n foo(ctx, vec![\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ]);\n}\n```",
+ "markdownDescription": "When structs, slices, arrays, and block/array-like macros are used as the last\nargument in an expression list, allow them to overflow (like blocks/closures)\ninstead of being indented on a new line.\n\nStable: No (tracking issue: [#3370](https://github.com/rust-lang/rustfmt/issues/3370))\n\n\n#### `false` (default):\n\n```rust\nfn example() {\n foo(ctx, |param| {\n action();\n foo(param)\n });\n\n foo(\n ctx,\n Bar {\n x: value,\n y: value2,\n },\n );\n\n foo(\n ctx,\n &[\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ],\n );\n\n foo(\n ctx,\n vec![\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ],\n );\n}\n```\n\n#### `true`:\n\n```rust\nfn example() {\n foo(ctx, |param| {\n action();\n foo(param)\n });\n\n foo(ctx, Bar {\n x: value,\n y: value2,\n });\n\n foo(ctx, &[\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ]);\n\n foo(ctx, vec![\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ]);\n}\n```",
+ "x-intellij-html-description": "When structs, slices, arrays, and block/array-like macros are used as the last\nargument in an expression list, allow them to overflow (like blocks/closures)\ninstead of being indented on a new line.
\nStable: No (tracking issue: #3370)
\nfalse
(default):fn example() {\n foo(ctx, |param| {\n action();\n foo(param)\n });\n\n foo(\n ctx,\n Bar {\n x: value,\n y: value2,\n },\n );\n\n foo(\n ctx,\n &[\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ],\n );\n\n foo(\n ctx,\n vec![\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ],\n );\n}\n
\ntrue
:fn example() {\n foo(ctx, |param| {\n action();\n foo(param)\n });\n\n foo(ctx, Bar {\n x: value,\n y: value2,\n });\n\n foo(ctx, &[\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ]);\n\n foo(ctx, vec![\n MAROON_TOMATOES,\n PURPLE_POTATOES,\n ORGANE_ORANGES,\n GREEN_PEARS,\n RED_APPLES,\n ]);\n}\n
\n",
+ "default": false
},
"remove_nested_parens": {
"type": "boolean",
- "description": "Remove nested parens\n\n[Documentation](https://rust-lang.github.io/rustfmt/#remove_nested_parens)",
- "default": true,
- "enum": [true, false]
+ "description": "Remove nested parens.\n\nDefault value: `true`,\n\nStable: Yes\n\n\n#### `true` (default):\n```rust\nfn main() {\n (foo());\n}\n```\n\n#### `false`:\n```rust\nfn main() {\n (foo());\n\n ((((foo()))));\n}\n```",
+ "markdownDescription": "Remove nested parens.\n\nDefault value: `true`,\n\nStable: Yes\n\n\n#### `true` (default):\n```rust\nfn main() {\n (foo());\n}\n```\n\n#### `false`:\n```rust\nfn main() {\n (foo());\n\n ((((foo()))));\n}\n```",
+ "x-intellij-html-description": "Remove nested parens.
\nDefault value: true
,
Stable: Yes
\ntrue
(default):fn main() {\n (foo());\n}\n
\nfalse
:fn main() {\n (foo());\n\n ((((foo()))));\n}\n
\n"
},
"reorder_impl_items": {
"type": "boolean",
- "description": "Reorder impl items\n\n[Documentation](https://rust-lang.github.io/rustfmt/#reorder_impl_items)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": false,
- "enum": [true, false]
+ "description": "Reorder impl items. `type` and `const` are put first, then macros and methods.\n\nStable: No (tracking issue: [#3363](https://github.com/rust-lang/rustfmt/issues/3363))\n\n\n#### `false` (default)\n\n```rust\nstruct Dummy;\n\nimpl Iterator for Dummy {\n fn next(&mut self) -> OptionReorder impl items. type
and const
are put first, then macros and methods.
Stable: No (tracking issue: #3363)
\nfalse
(default)struct Dummy;\n\nimpl Iterator for Dummy {\n fn next(&mut self) -> Option<Self::Item> {\n None\n }\n\n type Item = i32;\n}\n\nimpl Iterator for Dummy {\n type Item = i32;\n\n fn next(&mut self) -> Option<Self::Item> {\n None\n }\n}\n
\ntrue
struct Dummy;\n\nimpl Iterator for Dummy {\n type Item = i32;\n\n fn next(&mut self) -> Option<Self::Item> {\n None\n }\n}\n
\n",
+ "default": false
},
"reorder_imports": {
"type": "boolean",
- "description": "Reorder import and extern crate statements alphabetically\n\n[Documentation](https://rust-lang.github.io/rustfmt/#reorder_imports)",
- "default": true,
- "enum": [true, false]
+ "description": "Reorder import and extern crate statements alphabetically in groups (a group is\nseparated by a newline).\n\nStable: Yes\n\n\n#### `true` (default):\n\n```rust\nuse dolor;\nuse ipsum;\nuse lorem;\nuse sit;\n```\n\n#### `false`:\n\n```rust\nuse lorem;\nuse ipsum;\nuse dolor;\nuse sit;\n```",
+ "markdownDescription": "Reorder import and extern crate statements alphabetically in groups (a group is\nseparated by a newline).\n\nStable: Yes\n\n\n#### `true` (default):\n\n```rust\nuse dolor;\nuse ipsum;\nuse lorem;\nuse sit;\n```\n\n#### `false`:\n\n```rust\nuse lorem;\nuse ipsum;\nuse dolor;\nuse sit;\n```",
+ "x-intellij-html-description": "Reorder import and extern crate statements alphabetically in groups (a group is\nseparated by a newline).
\nStable: Yes
\ntrue
(default):use dolor;\nuse ipsum;\nuse lorem;\nuse sit;\n
\nfalse
:use lorem;\nuse ipsum;\nuse dolor;\nuse sit;\n
\n",
+ "default": true
+ },
+ "group_imports": {
+ "type": "string",
+ "description": "Controls the strategy for how consecutive imports are grouped together.\n\nControls the strategy for grouping sets of consecutive imports. Imports may contain newlines between imports and still be grouped together as a single set, but other statements between imports will result in different grouping sets.\n\nStable: No (tracking issue: [#5083](https://github.com/rust-lang/rustfmt/issues/5083))\n\nEach set of imports (one or more `use` statements, optionally separated by newlines) will be formatted independently. Other statements such as `mod ...` or `extern crate ...` will cause imports to not be grouped together.\n\n#### `Preserve` (default):\n\nPreserve the source file's import groups.\n\n```rust\nuse super::update::convert_publish_payload;\nuse chrono::Utc;\n\nuse alloc::alloc::Layout;\nuse juniper::{FieldError, FieldResult};\nuse uuid::Uuid;\n\nuse std::sync::Arc;\n\nuse broker::database::PooledConnection;\n\nuse super::schema::{Context, Payload};\nuse crate::models::Event;\nuse core::f32;\n```\n\n#### `StdExternalCrate`:\n\nDiscard existing import groups, and create three groups for:\n1. `std`, `core` and `alloc`,\n2. external crates,\n3. `self`, `super` and `crate` imports.\n\n```rust\nuse alloc::alloc::Layout;\nuse core::f32;\nuse std::sync::Arc;\n\nuse broker::database::PooledConnection;\nuse chrono::Utc;\nuse juniper::{FieldError, FieldResult};\nuse uuid::Uuid;\n\nuse super::schema::{Context, Payload};\nuse super::update::convert_publish_payload;\nuse crate::models::Event;\n```\n\n#### `One`:\n\nDiscard existing import groups, and create a single group for everything\n\n```rust\nuse super::schema::{Context, Payload};\nuse super::update::convert_publish_payload;\nuse crate::models::Event;\nuse alloc::alloc::Layout;\nuse broker::database::PooledConnection;\nuse chrono::Utc;\nuse core::f32;\nuse juniper::{FieldError, FieldResult};\nuse std::sync::Arc;\nuse uuid::Uuid;\n```",
+ "markdownDescription": "Controls the strategy for how consecutive imports are grouped together.\n\nControls the strategy for grouping sets of consecutive imports. Imports may contain newlines between imports and still be grouped together as a single set, but other statements between imports will result in different grouping sets.\n\nStable: No (tracking issue: [#5083](https://github.com/rust-lang/rustfmt/issues/5083))\n\nEach set of imports (one or more `use` statements, optionally separated by newlines) will be formatted independently. Other statements such as `mod ...` or `extern crate ...` will cause imports to not be grouped together.\n\n#### `Preserve` (default):\n\nPreserve the source file's import groups.\n\n```rust\nuse super::update::convert_publish_payload;\nuse chrono::Utc;\n\nuse alloc::alloc::Layout;\nuse juniper::{FieldError, FieldResult};\nuse uuid::Uuid;\n\nuse std::sync::Arc;\n\nuse broker::database::PooledConnection;\n\nuse super::schema::{Context, Payload};\nuse crate::models::Event;\nuse core::f32;\n```\n\n#### `StdExternalCrate`:\n\nDiscard existing import groups, and create three groups for:\n1. `std`, `core` and `alloc`,\n2. external crates,\n3. `self`, `super` and `crate` imports.\n\n```rust\nuse alloc::alloc::Layout;\nuse core::f32;\nuse std::sync::Arc;\n\nuse broker::database::PooledConnection;\nuse chrono::Utc;\nuse juniper::{FieldError, FieldResult};\nuse uuid::Uuid;\n\nuse super::schema::{Context, Payload};\nuse super::update::convert_publish_payload;\nuse crate::models::Event;\n```\n\n#### `One`:\n\nDiscard existing import groups, and create a single group for everything\n\n```rust\nuse super::schema::{Context, Payload};\nuse super::update::convert_publish_payload;\nuse crate::models::Event;\nuse alloc::alloc::Layout;\nuse broker::database::PooledConnection;\nuse chrono::Utc;\nuse core::f32;\nuse juniper::{FieldError, FieldResult};\nuse std::sync::Arc;\nuse uuid::Uuid;\n```",
+ "x-intellij-html-description": "Controls the strategy for how consecutive imports are grouped together.
\nControls the strategy for grouping sets of consecutive imports. Imports may contain newlines between imports and still be grouped together as a single set, but other statements between imports will result in different grouping sets.
\nStable: No (tracking issue: #5083)
\nEach set of imports (one or more use
statements, optionally separated by newlines) will be formatted independently. Other statements such as mod ...
or extern crate ...
will cause imports to not be grouped together.
Preserve
(default):Preserve the source file's import groups.
\nuse super::update::convert_publish_payload;\nuse chrono::Utc;\n\nuse alloc::alloc::Layout;\nuse juniper::{FieldError, FieldResult};\nuse uuid::Uuid;\n\nuse std::sync::Arc;\n\nuse broker::database::PooledConnection;\n\nuse super::schema::{Context, Payload};\nuse crate::models::Event;\nuse core::f32;\n
\nStdExternalCrate
:Discard existing import groups, and create three groups for:
\nstd
, core
and alloc
,self
, super
and crate
imports.use alloc::alloc::Layout;\nuse core::f32;\nuse std::sync::Arc;\n\nuse broker::database::PooledConnection;\nuse chrono::Utc;\nuse juniper::{FieldError, FieldResult};\nuse uuid::Uuid;\n\nuse super::schema::{Context, Payload};\nuse super::update::convert_publish_payload;\nuse crate::models::Event;\n
\nOne
:Discard existing import groups, and create a single group for everything
\nuse super::schema::{Context, Payload};\nuse super::update::convert_publish_payload;\nuse crate::models::Event;\nuse alloc::alloc::Layout;\nuse broker::database::PooledConnection;\nuse chrono::Utc;\nuse core::f32;\nuse juniper::{FieldError, FieldResult};\nuse std::sync::Arc;\nuse uuid::Uuid;\n
\n",
+ "default": "Preserve",
+ "enum": ["Preserve", "StdExternalCrate", "One"]
},
"reorder_modules": {
"type": "boolean",
- "description": "Reorder module statements alphabetically in group\n\n[Documentation](https://rust-lang.github.io/rustfmt/#reorder_modules)",
- "default": true,
- "enum": [true, false]
+ "description": "Reorder `mod` declarations alphabetically in group.\n\nStable: Yes\n\n\n#### `true` (default)\n\n```rust\nmod a;\nmod b;\n\nmod dolor;\nmod ipsum;\nmod lorem;\nmod sit;\n```\n\n#### `false`\n\n```rust\nmod b;\nmod a;\n\nmod lorem;\nmod ipsum;\nmod dolor;\nmod sit;\n```\n\n**Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantics\nof the original source code.",
+ "markdownDescription": "Reorder `mod` declarations alphabetically in group.\n\nStable: Yes\n\n\n#### `true` (default)\n\n```rust\nmod a;\nmod b;\n\nmod dolor;\nmod ipsum;\nmod lorem;\nmod sit;\n```\n\n#### `false`\n\n```rust\nmod b;\nmod a;\n\nmod lorem;\nmod ipsum;\nmod dolor;\nmod sit;\n```\n\n**Note** `mod` with `#[macro_export]` will not be reordered since that could change the semantics\nof the original source code.",
+ "x-intellij-html-description": "Reorder mod
declarations alphabetically in group.
Stable: Yes
\ntrue
(default)mod a;\nmod b;\n\nmod dolor;\nmod ipsum;\nmod lorem;\nmod sit;\n
\nfalse
mod b;\nmod a;\n\nmod lorem;\nmod ipsum;\nmod dolor;\nmod sit;\n
\nNote mod
with #[macro_export]
will not be reordered since that could change the semantics\nof the original source code.
Require a specific version of rustfmt. If you want to make sure that the\nspecific version of rustfmt is used in your CI, use this option.
\nPossible values: any published version (e.g. "0.3.8"
)
Stable: No (tracking issue: #3386)
\n", + "default": "CARGO_PKG_VERSION" }, - "report_todo": { - "type": "string", - "description": "Report all, none or unnumbered occurrences of TODO in source file comments\n\n[Documentation](https://rust-lang.github.io/rustfmt/#report_todo)\n\n### Unstable\nThis option requires Nightly Rust.", - "default": "Never", - "enum": ["Always", "Unnumbered", "Never"] + "short_array_element_width_threshold": { + "type": "integer", + "description": "The width threshold for an array element to be considered \"short\".\n\nThe layout of an array is dependent on the length of each of its elements. \nIf the length of every element in an array is below this threshold (all elements are \"short\") then the array can be formatted in the mixed/compressed style, but if any one element has a length that exceeds this threshold then the array elements will have to be formatted vertically.\n\nPossible values: any positive integer that is less than or equal to the value specified for `max_width`\n\nStable: Yes\n\n\n#### `10` (default):\n```rust\nfn main() {\n pub const FORMAT_TEST: [u64; 5] = [\n 0x0000000000000000,\n 0xaaaaaaaaaaaaaaaa,\n 0xbbbbbbbbbbbbbbbb,\n 0xcccccccccccccccc,\n 0xdddddddddddddddd,\n ];\n}\n```\n#### `20`:\n```rust\nfn main() {\n pub const FORMAT_TEST: [u64; 5] = [\n 0x0000000000000000, 0xaaaaaaaaaaaaaaaa, 0xbbbbbbbbbbbbbbbb, 0xcccccccccccccccc,\n 0xdddddddddddddddd,\n ];\n}\n```\nSee also `max_width`.", + "markdownDescription": "The width threshold for an array element to be considered \"short\".\n\nThe layout of an array is dependent on the length of each of its elements. \nIf the length of every element in an array is below this threshold (all elements are \"short\") then the array can be formatted in the mixed/compressed style, but if any one element has a length that exceeds this threshold then the array elements will have to be formatted vertically.\n\nPossible values: any positive integer that is less than or equal to the value specified for `max_width`\n\nStable: Yes\n\n\n#### `10` (default):\n```rust\nfn main() {\n pub const FORMAT_TEST: [u64; 5] = [\n 0x0000000000000000,\n 0xaaaaaaaaaaaaaaaa,\n 0xbbbbbbbbbbbbbbbb,\n 0xcccccccccccccccc,\n 0xdddddddddddddddd,\n ];\n}\n```\n#### `20`:\n```rust\nfn main() {\n pub const FORMAT_TEST: [u64; 5] = [\n 0x0000000000000000, 0xaaaaaaaaaaaaaaaa, 0xbbbbbbbbbbbbbbbb, 0xcccccccccccccccc,\n 0xdddddddddddddddd,\n ];\n}\n```\nSee also `max_width`.", + "x-intellij-html-description": "The width threshold for an array element to be considered "short".
\nThe layout of an array is dependent on the length of each of its elements. \nIf the length of every element in an array is below this threshold (all elements are "short") then the array can be formatted in the mixed/compressed style, but if any one element has a length that exceeds this threshold then the array elements will have to be formatted vertically.
\nPossible values: any positive integer that is less than or equal to the value specified for max_width
Stable: Yes
\n10
(default):fn main() {\n pub const FORMAT_TEST: [u64; 5] = [\n 0x0000000000000000,\n 0xaaaaaaaaaaaaaaaa,\n 0xbbbbbbbbbbbbbbbb,\n 0xcccccccccccccccc,\n 0xdddddddddddddddd,\n ];\n}\n
\n20
:fn main() {\n pub const FORMAT_TEST: [u64; 5] = [\n 0x0000000000000000, 0xaaaaaaaaaaaaaaaa, 0xbbbbbbbbbbbbbbbb, 0xcccccccccccccccc,\n 0xdddddddddddddddd,\n ];\n}\n
\nSee also max_width
.
Don't reformat out of line modules
\nStable: No (tracking issue: #3389)
\n", + "default": false }, "single_line_if_else_max_width": { "type": "integer", - "description": "Maximum line length for single line if-else expressions. A value of zero means always break if-else expressions.\n\n[Documentation](https://rust-lang.github.io/rustfmt/#single_line_if_else_max_width)", + "description": "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`.\n\nPossible values: any positive integer that is less than or equal to the value specified for `max_width`\n\nStable: Yes\n\nBy default this option is set as a percentage of `max_width` provided by `use_small_heuristics`, but a value set directly for `single_line_if_else_max_width` will take precedence.\n\nSee also `max_width` and `use_small_heuristics`", + "markdownDescription": "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`.\n\nPossible values: any positive integer that is less than or equal to the value specified for `max_width`\n\nStable: Yes\n\nBy default this option is set as a percentage of `max_width` provided by `use_small_heuristics`, but a value set directly for `single_line_if_else_max_width` will take precedence.\n\nSee also `max_width` and `use_small_heuristics`", + "x-intellij-html-description": "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
.
Possible values: any positive integer that is less than or equal to the value specified for max_width
Stable: Yes
\nBy default this option is set as a percentage of max_width
provided by use_small_heuristics
, but a value set directly for single_line_if_else_max_width
will take precedence.
See also max_width
and use_small_heuristics
Maximum line length for single line let-else statements.\nSee the let-else statement section of the Rust Style Guide for more details on when a let-else statement may be written on a single line.\nA value of 0
(zero) means the divergent else
block will always be formatted over multiple lines.\nNote this occurs when use_small_heuristics
is set to Off
.
By default this option is set as a percentage of max_width
provided by use_small_heuristics
, but a value set directly for single_line_let_else_max_width
will take precedence.
Possible values: any positive integer that is less than or equal to the value specified for max_width
Stable: Yes
\n50
(default):fn main() {\n let Some(w) = opt else { return Ok(()) };\n\n let Some(x) = opt else { return };\n\n let Some(y) = opt else {\n return;\n };\n\n let Some(z) = some_very_very_very_very_long_name else {\n return;\n };\n}\n
\n0
:fn main() {\n let Some(w) = opt else {\n return Ok(());\n };\n\n let Some(x) = opt else {\n return;\n };\n\n let Some(y) = opt else {\n return;\n };\n\n let Some(z) = some_very_very_very_very_long_name else {\n return;\n };\n}\n
\n100
:fn main() {\n let Some(w) = opt else { return Ok(()) };\n\n let Some(x) = opt else { return };\n\n let Some(y) = opt else {\n return;\n };\n\n let Some(z) = some_very_very_very_very_long_name else { return };\n}\n
\nSee also max_width
and use_small_heuristics
Leave a space after the colon.
\nStable: No (tracking issue: #3366)
\ntrue
(default):fn lorem<T: Eq>(t: T) {\n let lorem: Dolor = Lorem {\n ipsum: dolor,\n sit: amet,\n };\n}\n
\nfalse
:fn lorem<T:Eq>(t:T) {\n let lorem:Dolor = Lorem {\n ipsum:dolor,\n sit:amet,\n };\n}\n
\nSee also: space_before_colon
.
Leave a space before the colon.
\nStable: No (tracking issue: #3365)
\nfalse
(default):fn lorem<T: Eq>(t: T) {\n let lorem: Dolor = Lorem {\n ipsum: dolor,\n sit: amet,\n };\n}\n
\ntrue
:fn lorem<T : Eq>(t : T) {\n let lorem : Dolor = Lorem {\n ipsum : dolor,\n sit : amet,\n };\n}\n
\nSee also: space_after_colon
.
Put spaces around the .., ..=, and ... range operators
\nStable: No (tracking issue: #3367)
\nfalse
(default):fn main() {\n let lorem = 0..10;\n let ipsum = 0..=10;\n\n match lorem {\n 1..5 => foo(),\n _ => bar,\n }\n\n match lorem {\n 1..=5 => foo(),\n _ => bar,\n }\n\n match lorem {\n 1...5 => foo(),\n _ => bar,\n }\n}\n
\ntrue
:fn main() {\n let lorem = 0 .. 10;\n let ipsum = 0 ..= 10;\n\n match lorem {\n 1 .. 5 => foo(),\n _ => bar,\n }\n\n match lorem {\n 1 ..= 5 => foo(),\n _ => bar,\n }\n\n match lorem {\n 1 ... 5 => foo(),\n _ => bar,\n }\n}\n
\n",
+ "default": false
},
"struct_field_align_threshold": {
"type": "integer",
- "description": "Align struct fields if their diffs fits within threshold\n\n[Documentation](https://rust-lang.github.io/rustfmt/#struct_field_align_threshold)\n\n### Unstable\nThis option requires Nightly Rust.",
+ "description": "The maximum diff of width between struct fields to be aligned with each other.\n\nPossible values: any non-negative integer\n\nStable: No (tracking issue: [#3371](https://github.com/rust-lang/rustfmt/issues/3371))\n\n\n#### `0` (default):\n\n```rust\nstruct Foo {\n x: u32,\n yy: u32,\n zzz: u32,\n}\n```\n\n#### `20`:\n\n```rust\nstruct Foo {\n x: u32,\n yy: u32,\n zzz: u32,\n}\n```",
+ "markdownDescription": "The maximum diff of width between struct fields to be aligned with each other.\n\nPossible values: any non-negative integer\n\nStable: No (tracking issue: [#3371](https://github.com/rust-lang/rustfmt/issues/3371))\n\n\n#### `0` (default):\n\n```rust\nstruct Foo {\n x: u32,\n yy: u32,\n zzz: u32,\n}\n```\n\n#### `20`:\n\n```rust\nstruct Foo {\n x: u32,\n yy: u32,\n zzz: u32,\n}\n```",
+ "x-intellij-html-description": "The maximum diff of width between struct fields to be aligned with each other.
\nPossible values: any non-negative integer
\nStable: No (tracking issue: #3371)
\n0
(default):struct Foo {\n x: u32,\n yy: u32,\n zzz: u32,\n}\n
\n20
:struct Foo {\n x: u32,\n yy: u32,\n zzz: u32,\n}\n
\n",
"default": 0
},
"struct_lit_single_line": {
"type": "boolean",
- "description": "Put small struct literals on a single line\n\n[Documentation](https://rust-lang.github.io/rustfmt/#struct_lit_single_line)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": true,
- "enum": [true, false]
+ "description": "Put small struct literals on a single line\n\nStable: No (tracking issue: [#3357](https://github.com/rust-lang/rustfmt/issues/3357))\n\n\n#### `true` (default):\n\n```rust\nfn main() {\n let lorem = Lorem { foo: bar, baz: ofo };\n}\n```\n\n#### `false`:\n\n```rust\nfn main() {\n let lorem = Lorem {\n foo: bar,\n baz: ofo,\n };\n}\n```\n\nSee also: `indent_style`.",
+ "markdownDescription": "Put small struct literals on a single line\n\nStable: No (tracking issue: [#3357](https://github.com/rust-lang/rustfmt/issues/3357))\n\n\n#### `true` (default):\n\n```rust\nfn main() {\n let lorem = Lorem { foo: bar, baz: ofo };\n}\n```\n\n#### `false`:\n\n```rust\nfn main() {\n let lorem = Lorem {\n foo: bar,\n baz: ofo,\n };\n}\n```\n\nSee also: `indent_style`.",
+ "x-intellij-html-description": "Put small struct literals on a single line
\nStable: No (tracking issue: #3357)
\ntrue
(default):fn main() {\n let lorem = Lorem { foo: bar, baz: ofo };\n}\n
\nfalse
:fn main() {\n let lorem = Lorem {\n foo: bar,\n baz: ofo,\n };\n}\n
\nSee also: indent_style
.
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
.
Possible values: any positive integer that is less than or equal to the value specified for max_width
Stable: Yes
\nBy default this option is set as a percentage of max_width
provided by use_small_heuristics
, but a value set directly for struct_lit_width
will take precedence.
See also max_width
, use_small_heuristics
, and struct_lit_single_line
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
.
Possible values: any positive integer that is less than or equal to the value specified for max_width
Stable: Yes
\nBy default this option is set as a percentage of max_width
provided by use_small_heuristics
, but a value set directly for struct_variant_width
will take precedence.
See also max_width
and use_small_heuristics
Controls the edition of the Rust Style Guide to use for formatting (RFC 3338)
\nPossible values: "2015"
, "2018"
, "2021"
, "2024"
(unstable variant)
Stable: No
\n", + "default": "2015" + }, "tab_spaces": { "type": "integer", - "description": "Number of spaces per tab\n\n[Documentation](https://rust-lang.github.io/rustfmt/#tab_spaces)", + "description": "Number of spaces per tab\n\nPossible values: any positive integer\n\nStable: Yes\n\n\n#### `4` (default):\n\n```rust\nfn lorem() {\n let ipsum = dolor();\n let sit = vec![\n \"amet consectetur adipiscing elit amet\",\n \"consectetur adipiscing elit amet consectetur.\",\n ];\n}\n```\n\n#### `2`:\n\n```rust\nfn lorem() {\n let ipsum = dolor();\n let sit = vec![\n \"amet consectetur adipiscing elit amet\",\n \"consectetur adipiscing elit amet consectetur.\",\n ];\n}\n```\n\nSee also: `hard_tabs`.", + "markdownDescription": "Number of spaces per tab\n\nPossible values: any positive integer\n\nStable: Yes\n\n\n#### `4` (default):\n\n```rust\nfn lorem() {\n let ipsum = dolor();\n let sit = vec![\n \"amet consectetur adipiscing elit amet\",\n \"consectetur adipiscing elit amet consectetur.\",\n ];\n}\n```\n\n#### `2`:\n\n```rust\nfn lorem() {\n let ipsum = dolor();\n let sit = vec![\n \"amet consectetur adipiscing elit amet\",\n \"consectetur adipiscing elit amet consectetur.\",\n ];\n}\n```\n\nSee also: `hard_tabs`.", + "x-intellij-html-description": "Number of spaces per tab
\nPossible values: any positive integer
\nStable: Yes
\n4
(default):fn lorem() {\n let ipsum = dolor();\n let sit = vec![\n "amet consectetur adipiscing elit amet",\n "consectetur adipiscing elit amet consectetur.",\n ];\n}\n
\n2
:fn lorem() {\n let ipsum = dolor();\n let sit = vec![\n "amet consectetur adipiscing elit amet",\n "consectetur adipiscing elit amet consectetur.",\n ];\n}\n
\nSee also: hard_tabs
.
How to handle trailing commas for lists
\nStable: No (tracking issue: #3379)
\n"Vertical"
(default):fn main() {\n let Lorem { ipsum, dolor, sit } = amet;\n let Lorem {\n ipsum,\n dolor,\n sit,\n amet,\n consectetur,\n adipiscing,\n } = elit;\n}\n
\n"Always"
:fn main() {\n let Lorem { ipsum, dolor, sit, } = amet;\n let Lorem {\n ipsum,\n dolor,\n sit,\n amet,\n consectetur,\n adipiscing,\n } = elit;\n}\n
\n"Never"
:fn main() {\n let Lorem { ipsum, dolor, sit } = amet;\n let Lorem {\n ipsum,\n dolor,\n sit,\n amet,\n consectetur,\n adipiscing\n } = elit;\n}\n
\nSee also: match_block_trailing_comma
.
Add trailing semicolon after break, continue and return
\nStable: No (tracking issue: #3378)
\ntrue
(default):fn foo() -> usize {\n return 0;\n}\n
\nfalse
:fn foo() -> usize {\n return 0\n}\n
\n",
+ "default": true
},
"type_punctuation_density": {
"type": "string",
- "description": "Determines if '+' or '=' are wrapped in spaces in the punctuation of types\n\n[Documentation](https://rust-lang.github.io/rustfmt/#type_punctuation_density)\n\n### Unstable\nThis option requires Nightly Rust.",
+ "description": "Determines if `+` or `=` are wrapped in spaces in the punctuation of types\n\nStable: No (tracking issue: [#3364](https://github.com/rust-lang/rustfmt/issues/3364))\n\n\n#### `\"Wide\"` (default):\n\n```rust\nfn loremDetermines if +
or =
are wrapped in spaces in the punctuation of types
Stable: No (tracking issue: #3364)
\n"Wide"
(default):fn lorem<Ipsum: Dolor + Sit = Amet>() {\n // body\n}\n
\n"Compressed"
:fn lorem<Ipsum: Dolor+Sit=Amet>() {\n // body\n}\n
\n",
"default": "Wide",
"enum": ["Compressed", "Wide"]
},
"unstable_features": {
"type": "boolean",
- "description": "Enables unstable features. Only available on nightly channel\n\n[Documentation](https://rust-lang.github.io/rustfmt/#unstable_features)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": false,
- "enum": [true, false]
+ "description": "Enable unstable features on the unstable channel.\n\nStable: No (tracking issue: [#3387](https://github.com/rust-lang/rustfmt/issues/3387))",
+ "markdownDescription": "Enable unstable features on the unstable channel.\n\nStable: No (tracking issue: [#3387](https://github.com/rust-lang/rustfmt/issues/3387))",
+ "x-intellij-html-description": "Enable unstable features on the unstable channel.
\nStable: No (tracking issue: #3387)
\n", + "default": false }, "use_field_init_shorthand": { "type": "boolean", - "description": "Use field initialization shorthand if possible\n\n[Documentation](https://rust-lang.github.io/rustfmt/#use_field_init_shorthand)", - "default": false, - "enum": [true, false] + "description": "Use field initialize shorthand if possible.\n\nStable: Yes\n\n\n#### `false` (default):\n\n```rust\nstruct Foo {\n x: u32,\n y: u32,\n z: u32,\n}\n\nfn main() {\n let x = 1;\n let y = 2;\n let z = 3;\n let a = Foo { x, y, z };\n let b = Foo { x: x, y: y, z: z };\n}\n```\n\n#### `true`:\n\n```rust\nstruct Foo {\n x: u32,\n y: u32,\n z: u32,\n}\n\nfn main() {\n let x = 1;\n let y = 2;\n let z = 3;\n let a = Foo { x, y, z };\n}\n```", + "markdownDescription": "Use field initialize shorthand if possible.\n\nStable: Yes\n\n\n#### `false` (default):\n\n```rust\nstruct Foo {\n x: u32,\n y: u32,\n z: u32,\n}\n\nfn main() {\n let x = 1;\n let y = 2;\n let z = 3;\n let a = Foo { x, y, z };\n let b = Foo { x: x, y: y, z: z };\n}\n```\n\n#### `true`:\n\n```rust\nstruct Foo {\n x: u32,\n y: u32,\n z: u32,\n}\n\nfn main() {\n let x = 1;\n let y = 2;\n let z = 3;\n let a = Foo { x, y, z };\n}\n```", + "x-intellij-html-description": "Use field initialize shorthand if possible.
\nStable: Yes
\nfalse
(default):struct Foo {\n x: u32,\n y: u32,\n z: u32,\n}\n\nfn main() {\n let x = 1;\n let y = 2;\n let z = 3;\n let a = Foo { x, y, z };\n let b = Foo { x: x, y: y, z: z };\n}\n
\ntrue
:struct Foo {\n x: u32,\n y: u32,\n z: u32,\n}\n\nfn main() {\n let x = 1;\n let y = 2;\n let z = 3;\n let a = Foo { x, y, z };\n}\n
\n",
+ "default": false
},
"use_small_heuristics": {
"type": "string",
- "description": "Whether to use different formatting for items and expressions if they satisfy a heuristic notion of 'small'\n\n[Documentation](https://rust-lang.github.io/rustfmt/#use_small_heuristics)",
+ "description": "This option can be used to simplify the management and bulk updates of the granular width configuration settings (`fn_call_width`, `attr_fn_like_width`, `struct_lit_width`, `struct_variant_width`, `array_width`, `chain_width`, `single_line_if_else_max_width`), that respectively control when formatted constructs are multi-lined/vertical based on width.\n\nNote that explicitly provided values for the width configuration settings take precedence and override the calculated values determined by `use_small_heuristics`.\n\nStable: Yes\n\n\n#### `Default` (default):\nWhen `use_small_heuristics` is set to `Default`, the values for the granular width settings are calculated as a ratio of the value for `max_width`.\n\nThe ratios are:\n* `fn_call_width` - `60%`\n* `attr_fn_like_width` - `70%`\n* `struct_lit_width` - `18%`\n* `struct_variant_width` - `35%`\n* `array_width` - `60%`\n* `chain_width` - `60%`\n* `single_line_if_else_max_width` - `50%`\n* `single_line_let_else_max_width` - `50%`\n\nFor example when `max_width` is set to `100`, the width settings are:\n* `fn_call_width=60`\n* `attr_fn_like_width=70`\n* `struct_lit_width=18`\n* `struct_variant_width=35`\n* `array_width=60`\n* `chain_width=60`\n* `single_line_if_else_max_width=50`\n* `single_line_let_else_max_width=50`\n\nand when `max_width` is set to `200`:\n* `fn_call_width=120`\n* `attr_fn_like_width=140`\n* `struct_lit_width=36`\n* `struct_variant_width=70`\n* `array_width=120`\n* `chain_width=120`\n* `single_line_if_else_max_width=100`\n* `single_line_let_else_max_width=100`\n\n```rust\nenum Lorem {\n Ipsum,\n Dolor(bool),\n Sit { amet: Consectetur, adipiscing: Elit },\n}\n\nfn main() {\n lorem(\n \"lorem\",\n \"ipsum\",\n \"dolor\",\n \"sit\",\n \"amet\",\n \"consectetur\",\n \"adipiscing\",\n );\n\n let lorem = Lorem {\n ipsum: dolor,\n sit: amet,\n };\n let lorem = Lorem { ipsum: dolor };\n\n let lorem = if ipsum { dolor } else { sit };\n}\n```\n\n#### `Off`:\nWhen `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.\n\n```rust\nenum Lorem {\n Ipsum,\n Dolor(bool),\n Sit {\n amet: Consectetur,\n adipiscing: Elit,\n },\n}\n\nfn main() {\n lorem(\"lorem\", \"ipsum\", \"dolor\", \"sit\", \"amet\", \"consectetur\", \"adipiscing\");\n\n let lorem = Lorem {\n ipsum: dolor,\n sit: amet,\n };\n\n let lorem = if ipsum {\n dolor\n } else {\n sit\n };\n}\n```\n\n#### `Max`:\nWhen `use_small_heuristics` is set to `Max`, then each granular width setting is set to the same value as `max_width`.\n\nSo if `max_width` is set to `200`, then all the width settings are also set to `200`.\n* `fn_call_width=200`\n* `attr_fn_like_width=200`\n* `struct_lit_width=200`\n* `struct_variant_width=200`\n* `array_width=200`\n* `chain_width=200`\n* `single_line_if_else_max_width=200`\n* `single_line_let_else_max_width=200`\n\n```rust\nenum Lorem {\n Ipsum,\n Dolor(bool),\n Sit { amet: Consectetur, adipiscing: Elit },\n}\n\nfn main() {\n lorem(\"lorem\", \"ipsum\", \"dolor\", \"sit\", \"amet\", \"consectetur\", \"adipiscing\");\n\n let lorem = Lorem { ipsum: dolor, sit: amet };\n\n let lorem = if ipsum { dolor } else { sit };\n}\n```\n\n\nSee also:\n* `max_width`\n* `fn_call_width`\n* `attr_fn_like_width`\n* `struct_lit_width`\n* `struct_variant_width`\n* `array_width`\n* `chain_width`\n* `single_line_if_else_max_width`\n* `single_line_let_else_max_width`",
+ "markdownDescription": "This option can be used to simplify the management and bulk updates of the granular width configuration settings (`fn_call_width`, `attr_fn_like_width`, `struct_lit_width`, `struct_variant_width`, `array_width`, `chain_width`, `single_line_if_else_max_width`), that respectively control when formatted constructs are multi-lined/vertical based on width.\n\nNote that explicitly provided values for the width configuration settings take precedence and override the calculated values determined by `use_small_heuristics`.\n\nStable: Yes\n\n\n#### `Default` (default):\nWhen `use_small_heuristics` is set to `Default`, the values for the granular width settings are calculated as a ratio of the value for `max_width`.\n\nThe ratios are:\n* `fn_call_width` - `60%`\n* `attr_fn_like_width` - `70%`\n* `struct_lit_width` - `18%`\n* `struct_variant_width` - `35%`\n* `array_width` - `60%`\n* `chain_width` - `60%`\n* `single_line_if_else_max_width` - `50%`\n* `single_line_let_else_max_width` - `50%`\n\nFor example when `max_width` is set to `100`, the width settings are:\n* `fn_call_width=60`\n* `attr_fn_like_width=70`\n* `struct_lit_width=18`\n* `struct_variant_width=35`\n* `array_width=60`\n* `chain_width=60`\n* `single_line_if_else_max_width=50`\n* `single_line_let_else_max_width=50`\n\nand when `max_width` is set to `200`:\n* `fn_call_width=120`\n* `attr_fn_like_width=140`\n* `struct_lit_width=36`\n* `struct_variant_width=70`\n* `array_width=120`\n* `chain_width=120`\n* `single_line_if_else_max_width=100`\n* `single_line_let_else_max_width=100`\n\n```rust\nenum Lorem {\n Ipsum,\n Dolor(bool),\n Sit { amet: Consectetur, adipiscing: Elit },\n}\n\nfn main() {\n lorem(\n \"lorem\",\n \"ipsum\",\n \"dolor\",\n \"sit\",\n \"amet\",\n \"consectetur\",\n \"adipiscing\",\n );\n\n let lorem = Lorem {\n ipsum: dolor,\n sit: amet,\n };\n let lorem = Lorem { ipsum: dolor };\n\n let lorem = if ipsum { dolor } else { sit };\n}\n```\n\n#### `Off`:\nWhen `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.\n\n```rust\nenum Lorem {\n Ipsum,\n Dolor(bool),\n Sit {\n amet: Consectetur,\n adipiscing: Elit,\n },\n}\n\nfn main() {\n lorem(\"lorem\", \"ipsum\", \"dolor\", \"sit\", \"amet\", \"consectetur\", \"adipiscing\");\n\n let lorem = Lorem {\n ipsum: dolor,\n sit: amet,\n };\n\n let lorem = if ipsum {\n dolor\n } else {\n sit\n };\n}\n```\n\n#### `Max`:\nWhen `use_small_heuristics` is set to `Max`, then each granular width setting is set to the same value as `max_width`.\n\nSo if `max_width` is set to `200`, then all the width settings are also set to `200`.\n* `fn_call_width=200`\n* `attr_fn_like_width=200`\n* `struct_lit_width=200`\n* `struct_variant_width=200`\n* `array_width=200`\n* `chain_width=200`\n* `single_line_if_else_max_width=200`\n* `single_line_let_else_max_width=200`\n\n```rust\nenum Lorem {\n Ipsum,\n Dolor(bool),\n Sit { amet: Consectetur, adipiscing: Elit },\n}\n\nfn main() {\n lorem(\"lorem\", \"ipsum\", \"dolor\", \"sit\", \"amet\", \"consectetur\", \"adipiscing\");\n\n let lorem = Lorem { ipsum: dolor, sit: amet };\n\n let lorem = if ipsum { dolor } else { sit };\n}\n```\n\n\nSee also:\n* `max_width`\n* `fn_call_width`\n* `attr_fn_like_width`\n* `struct_lit_width`\n* `struct_variant_width`\n* `array_width`\n* `chain_width`\n* `single_line_if_else_max_width`\n* `single_line_let_else_max_width`",
+ "x-intellij-html-description": "This option can be used to simplify the management and bulk updates of the granular width configuration settings (fn_call_width
, attr_fn_like_width
, struct_lit_width
, struct_variant_width
, array_width
, chain_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
.
Stable: Yes
\nDefault
(default):When use_small_heuristics
is set to Default
, the values for the granular width settings are calculated as a ratio of the value for max_width
.
The ratios are:
\nfn_call_width
- 60%
attr_fn_like_width
- 70%
struct_lit_width
- 18%
struct_variant_width
- 35%
array_width
- 60%
chain_width
- 60%
single_line_if_else_max_width
- 50%
single_line_let_else_max_width
- 50%
For example when max_width
is set to 100
, the width settings are:
fn_call_width=60
attr_fn_like_width=70
struct_lit_width=18
struct_variant_width=35
array_width=60
chain_width=60
single_line_if_else_max_width=50
single_line_let_else_max_width=50
and when max_width
is set to 200
:
fn_call_width=120
attr_fn_like_width=140
struct_lit_width=36
struct_variant_width=70
array_width=120
chain_width=120
single_line_if_else_max_width=100
single_line_let_else_max_width=100
enum Lorem {\n Ipsum,\n Dolor(bool),\n Sit { amet: Consectetur, adipiscing: Elit },\n}\n\nfn main() {\n lorem(\n "lorem",\n "ipsum",\n "dolor",\n "sit",\n "amet",\n "consectetur",\n "adipiscing",\n );\n\n let lorem = Lorem {\n ipsum: dolor,\n sit: amet,\n };\n let lorem = Lorem { ipsum: dolor };\n\n let lorem = if ipsum { dolor } else { sit };\n}\n
\nOff
: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.
enum Lorem {\n Ipsum,\n Dolor(bool),\n Sit {\n amet: Consectetur,\n adipiscing: Elit,\n },\n}\n\nfn main() {\n lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing");\n\n let lorem = Lorem {\n ipsum: dolor,\n sit: amet,\n };\n\n let lorem = if ipsum {\n dolor\n } else {\n sit\n };\n}\n
\nMax
:When use_small_heuristics
is set to Max
, then each granular width setting is set to the same value as max_width
.
So if max_width
is set to 200
, then all the width settings are also set to 200
.
fn_call_width=200
attr_fn_like_width=200
struct_lit_width=200
struct_variant_width=200
array_width=200
chain_width=200
single_line_if_else_max_width=200
single_line_let_else_max_width=200
enum Lorem {\n Ipsum,\n Dolor(bool),\n Sit { amet: Consectetur, adipiscing: Elit },\n}\n\nfn main() {\n lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing");\n\n let lorem = Lorem { ipsum: dolor, sit: amet };\n\n let lorem = if ipsum { dolor } else { sit };\n}\n
\nSee also:
\nmax_width
fn_call_width
attr_fn_like_width
struct_lit_width
struct_variant_width
array_width
chain_width
single_line_if_else_max_width
single_line_let_else_max_width
Replace uses of the try! macro by the ? shorthand
\nStable: Yes
\nfalse
(default):fn main() {\n let lorem = ipsum.map(|dolor| dolor.sit())?;\n\n let lorem = try!(ipsum.map(|dolor| dolor.sit()));\n}\n
\ntrue
:fn main() {\n let lorem = ipsum.map(|dolor| dolor.sit())?;\n}\n
\n",
+ "default": false
},
"version": {
"type": "string",
- "description": "Version of formatting rules\n\n[Documentation](https://rust-lang.github.io/rustfmt/#version)\n\n### Unstable\nThis option requires Nightly Rust.",
+ "description": "This option is deprecated and has been replaced by `style_edition`.\n`version = \"One\"` is equivalent to `style_edition = \"(2015|2018|2021)\"` and\n`version = \"Two\"` is equivalent to `style_edition = \"2024\"`\n\nStable: No (tracking issue: [#3383](https://github.com/rust-lang/rustfmt/issues/3383))\n\n\n### Example\n\n```toml\nversion = \"Two\"\n```",
+ "markdownDescription": "This option is deprecated and has been replaced by `style_edition`.\n`version = \"One\"` is equivalent to `style_edition = \"(2015|2018|2021)\"` and\n`version = \"Two\"` is equivalent to `style_edition = \"2024\"`\n\nStable: No (tracking issue: [#3383](https://github.com/rust-lang/rustfmt/issues/3383))\n\n\n### Example\n\n```toml\nversion = \"Two\"\n```",
+ "x-intellij-html-description": "This option is deprecated and has been replaced by style_edition
.\nversion = "One"
is equivalent to style_edition = "(2015|2018|2021)"
and\nversion = "Two"
is equivalent to style_edition = "2024"
Stable: No (tracking issue: #3383)
\nversion = "Two"\n
\n",
"default": "One",
"enum": ["One", "Two"]
},
"where_single_line": {
"type": "boolean",
- "description": "Force where-clauses to be on a single line\n\n[Documentation](https://rust-lang.github.io/rustfmt/#where_single_line)\n\n### Unstable\nThis option requires Nightly Rust.",
- "default": false,
- "enum": [true, false]
+ "description": "Forces the `where` clause to be laid out on a single line.\n\nStable: No (tracking issue: [#3359](https://github.com/rust-lang/rustfmt/issues/3359))\n\n\n#### `false` (default):\n\n```rust\nimplForces the where
clause to be laid out on a single line.
Stable: No (tracking issue: #3359)
\nfalse
(default):impl<T> Lorem for T\nwhere\n Option<T>: Ipsum,\n{\n // body\n}\n
\ntrue
:impl<T> Lorem for T\nwhere Option<T>: Ipsum\n{\n // body\n}\n
\nSee also brace_style
, control_brace_style
.
Break comments to fit on the line
\nNote that no wrapping will happen if:
\nStable: No (tracking issue: #3347)
\nfalse
(default):// Lorem ipsum dolor sit amet, consectetur adipiscing elit,\n// sed do eiusmod tempor incididunt ut labore et dolore\n// magna aliqua. Ut enim ad minim veniam, quis nostrud\n// exercitation ullamco laboris nisi ut aliquip ex ea\n// commodo consequat.\n\n// Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n\n// Information on the lorem ipsum can be found at the following url: https://en.wikipedia.org/wiki/Lorem_ipsum. Its text is: lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n\n/// # This doc comment is a very long header (it starts with a '#'). Had it not been a header it would have been wrapped. But because it is a header, it will not be. That is because wrapping a markdown header breaks it.\nstruct Foo {}\n
\ntrue
:// Lorem ipsum dolor sit amet, consectetur adipiscing elit,\n// sed do eiusmod tempor incididunt ut labore et dolore\n// magna aliqua. Ut enim ad minim veniam, quis nostrud\n// exercitation ullamco laboris nisi ut aliquip ex ea\n// commodo consequat.\n\n// Lorem ipsum dolor sit amet, consectetur adipiscing elit,\n// sed do eiusmod tempor incididunt ut labore et dolore\n// magna aliqua. Ut enim ad minim veniam, quis nostrud\n// exercitation ullamco laboris nisi ut aliquip ex ea\n// commodo consequat.\n\n// Information on the lorem ipsum can be found at the following url: https://en.wikipedia.org/wiki/Lorem_ipsum. Its text is: lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n\n/// # This doc comment is a very long header (it starts with a '#'). Had it not been a header it would have been wrapped. But because it is a header, it will not be. That is because wrapping a markdown header breaks it.\nstruct Foo {}\n
\n",
+ "default": false
}
- },
- "title": "rustfmt schema",
- "type": "object",
- "x-taplo-info": {
- "authors": ["Aloso (https://github.com/Aloso)"],
- "patterns": ["^(.*(/|\\\\)\\.?rustfmt\\.toml|rustfmt\\.toml)$"]
}
}
From f1e59de163fc7ef6e5c8acc4cc4b24e40831735a Mon Sep 17 00:00:00 2001
From: Pierre-Luc Paour This is equivalent to tox.ini
format, with the difference that the text is stored instead inside the pyproject.toml
file under the tool.tox
table and legacy_tox_ini
key.
Windows
, Darwin
, Linux
, or All
. If specified, pyright will tailor its use of type stub files, which conditionalize type definitions based on the platform. If no platform is specified, pyright will use the current platform.",
"default": "",
- "examples": ["Linux"],
- "pattern": "^(Linux|Windows|Darwin|All)$"
+ "examples": ["Linux"]
},
"disableBytesTypePromotions": {
"type": "boolean",
@@ -674,8 +666,7 @@
"title": "Path to configuration file that this configuration extends",
"description": "Path to another `.json` or `.toml` file that is used as a \"base configuration\", allowing this configuration to inherit configuration settings. Top-level keys within this configuration overwrite top-level keys in the base configuration. Multiple levels of inheritance are supported. Relative paths specified in a configuration file are resolved relative to the location of that configuration file.",
"markdownDescription": "Path to another `.json` or `.toml` file that is used as a \"base configuration\", allowing this configuration to inherit configuration settings. Top-level keys within this configuration overwrite top-level keys in the base configuration. Multiple levels of inheritance are supported. Relative paths specified in a configuration file are resolved relative to the location of that configuration file.",
- "x-intellij-html-description": "Path to another .json
or .toml
file that is used as a "base configuration", allowing this configuration to inherit configuration settings. Top-level keys within this configuration overwrite top-level keys in the base configuration. Multiple levels of inheritance are supported. Relative paths specified in a configuration file are resolved relative to the location of that configuration file.",
- "pattern": "^(.*)$"
+ "x-intellij-html-description": "Path to another .json
or .toml
file that is used as a "base configuration", allowing this configuration to inherit configuration settings. Top-level keys within this configuration overwrite top-level keys in the base configuration. Multiple levels of inheritance are supported. Relative paths specified in a configuration file are resolved relative to the location of that configuration file."
},
"include": {
"type": "array",
@@ -685,8 +676,7 @@
"x-intellij-html-description": "Paths of directories or files that should be considered part of the project. If no paths are specified, pyright defaults to the directory that contains the config file. Paths may contain wildcard characters: **
(a directory or multiple levels of directories), *
(a sequence of zero or more characters), or ?
(a single character). If no include paths are specified, the root path for the workspace is assumed.",
"items": {
"type": "string",
- "description": "File or directory to include in type analysis",
- "pattern": "^(.*)$"
+ "description": "File or directory to include in type analysis"
}
},
"exclude": {
@@ -697,8 +687,7 @@
"x-intellij-html-description": "Paths of directories or files that should not be considered part of the project. These override the includes directories and files, allowing specific subdirectories to be excluded. Note that files in the exclude paths may still be included in the analysis if they are referenced (imported) by source files that are not excluded. Paths may contain wildcard characters: **
(a directory or multiple levels of directories), *
(a sequence of zero or more characters), or ?
(a single character). If no exclude paths are specified, Pyright automatically excludes the following: **/node_modules
, **/__pycache__
, **/.*
and any virtual environment directories.",
"items": {
"type": "string",
- "title": "File or directory to exclude from type analysis",
- "pattern": "^(.*)$"
+ "title": "File or directory to exclude from type analysis"
}
},
"ignore": {
@@ -709,8 +698,7 @@
"x-intellij-html-description": "Paths of directories or files whose diagnostic output (errors and warnings) should be suppressed even if they are an included file or within the transitive closure of an included file. Paths may contain wildcard characters: **
(a directory or multiple levels of directories), *
(a sequence of zero or more characters), or ?
(a single character).",
"items": {
"type": "string",
- "title": "File or directory where diagnostics should be suppressed",
- "pattern": "^(.*)$"
+ "title": "File or directory where diagnostics should be suppressed"
}
},
"strict": {
@@ -721,8 +709,7 @@
"x-intellij-html-description": "Paths of directories or files that should use "strict" analysis if they are included. This is the same as manually adding a # pyright: strict
comment. In strict mode, most type-checking rules are enabled. Paths may contain wildcard characters: **
(a directory or multiple levels of directories), *
(a sequence of zero or more characters), or ?
(a single character).",
"items": {
"type": "string",
- "title": "File or directory that should use \"strict\" type checking rules",
- "pattern": "^(.*)$"
+ "title": "File or directory that should use \"strict\" type checking rules"
}
},
"defineConstant": {
@@ -738,7 +725,6 @@
}
},
"typeCheckingMode": {
- "type": "string",
"enum": ["off", "basic", "standard", "strict"],
"title": "Specifies the default rule set to use for type checking",
"description": "Specifies the default rule set to use. Some rules can be overridden using additional configuration flags documented below. If set to `off`, all type-checking rules are disabled, but Python syntax and semantic errors are still reported.",
@@ -758,8 +744,7 @@
"description": "Path to a directory that contains `typeshed` type stub files. Pyright ships with a bundled copy of `typeshed` type stubs. If you want to use a different version of `typeshed` stubs, you can clone the `typeshed` GitHub repo (https://github.com/python/typeshed) to a local directory and reference the location with this path. This option is useful if you're actively contributing updates to `typeshed`.",
"markdownDescription": "Path to a directory that contains `typeshed` type stub files. Pyright ships with a bundled copy of `typeshed` type stubs. If you want to use a different version of `typeshed` stubs, you can clone [the `typeshed` GitHub repo](https://github.com/python/typeshed) to a local directory and reference the location with this path. This option is useful if you're actively contributing updates to `typeshed`.",
"x-intellij-html-description": "Path to a directory that contains typeshed
type stub files. Pyright ships with a bundled copy of typeshed
type stubs. If you want to use a different version of typeshed
stubs, you can clone the typeshed
GitHub repo to a local directory and reference the location with this path. This option is useful if you're actively contributing updates to typeshed
.",
- "default": "",
- "pattern": "^(.*)$"
+ "default": ""
},
"stubPath": {
"type": "string",
@@ -767,8 +752,7 @@
"description": "Path to a directory that contains custom type stubs. Each package's type stub file(s) are expected to be in its own subdirectory.",
"x-intellij-html-description": "Path to a directory that contains custom type stubs. Each package's type stub file(s) are expected to be in its own subdirectory.",
"default": "./typings",
- "examples": ["src/typestubs"],
- "pattern": "^(.*)$"
+ "examples": ["src/typestubs"]
},
"disableBytesTypePromotions": {
"$ref": "#/definitions/disableBytesTypePromotions"
@@ -1058,8 +1042,7 @@
"description": "Path to a directory containing one or more subdirectories, each of which contains a virtual environment. When used in conjunction with a `venv` setting, pyright will search for imports in the virtual environment's site-packages directory rather than the paths specified by the default Python interpreter. If you are working on a project with other developers, it is best not to specify this setting in the config file, since this path will typically differ for each developer. Instead, it can be specified on the command line or in a per-user setting.",
"markdownDescription": "Path to a directory containing one or more subdirectories, each of which contains a virtual environment. When used in conjunction with a `venv` setting, pyright will search for imports in the virtual environment's site-packages directory rather than the paths specified by the default Python interpreter. If you are working on a project with other developers, it is best not to specify this setting in the config file, since this path will typically differ for each developer. Instead, it can be specified on the command line or in a per-user setting.",
"x-intellij-html-description": "Path to a directory containing one or more subdirectories, each of which contains a virtual environment. When used in conjunction with a venv
setting, pyright will search for imports in the virtual environment's site-packages directory rather than the paths specified by the default Python interpreter. If you are working on a project with other developers, it is best not to specify this setting in the config file, since this path will typically differ for each developer. Instead, it can be specified on the command line or in a per-user setting.",
- "default": "",
- "pattern": "^(.*)$"
+ "default": ""
},
"venv": {
"type": "string",
@@ -1068,8 +1051,7 @@
"markdownDescription": "Used in conjunction with the `venvPath`, specifies the virtual environment to use.",
"x-intellij-html-description": "Used in conjunction with the venvPath
, specifies the virtual environment to use.",
"default": "",
- "examples": ["python37"],
- "pattern": "^(.*)$"
+ "examples": ["python37"]
},
"verboseOutput": {
"type": "boolean",
@@ -1090,8 +1072,7 @@
"type": "string",
"title": "Path to code subdirectory to which these settings apply",
"description": "Root path for the code that will execute within this execution environment.",
- "default": "",
- "pattern": "^(.*)$"
+ "default": ""
},
"disableBytesTypePromotions": {
"$ref": "#/definitions/disableBytesTypePromotions"
From ab8cd6746b840592ff91a111647f8c27e1af2c9a Mon Sep 17 00:00:00 2001
From: Marc Rousavy