Skip to content

Replace 'positive integer' with 'nonnegative integer' #6583

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Below you find a detailed visual guide on all the supported configuration option
Maximum width of an array literal before falling back to vertical formatting.

- **Default value**: `60`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Possible values**: any nonnegative integer that is less than or equal to the value specified for [`max_width`](#max_width)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nonnegative is technically correct, but there's something about the double negative that I don't like. The set of Whole numbers also includes zero and positive integer values. How about this?

- **Possible values**: Any whole number in the range [0, [`max_width`](#max_width)]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A drawback is that the term whole number has three different common definitions, making it less clear; e.g., see https://mathworld.wolfram.com/WholeNumber.html. The double negative in "nonnegative integer" is annoying but I don't know of any other unambiguous alternative. From what I've seen, "nonnegative integer" is the more-or-less standard terminology in math and computer science, with exceptions like in elementary school where "whole number" is used (as the concept of negative numbers isn't yet introduced), or in type theory or fundamentals of mathematics where "natural number" is commonly used (e.g. coming logically before constructing the set of integers), though that term is also ambiguous since some authors exclude zero from "natural numbers".

- **Stable**: Yes

By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `array_width` will take precedence.
Expand All @@ -34,7 +34,7 @@ See also [`max_width`](#max_width) and [`use_small_heuristics`](#use_small_heuri
Maximum width of the args of a function-like attributes before falling back to vertical formatting.

- **Default value**: `70`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Possible values**: any nonnegative integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: Yes

By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `attr_fn_like_width` will take precedence.
Expand Down Expand Up @@ -300,7 +300,7 @@ where
Maximum width of a chain to fit on one line.

- **Default value**: `60`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Possible values**: any nonnegative integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: Yes

By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `chain_width` will take precedence.
Expand Down Expand Up @@ -428,7 +428,7 @@ fn example() {
Maximum length of comments. No effect unless `wrap_comments = true`.

- **Default value**: `80`
- **Possible values**: any positive integer
- **Possible values**: any nonnegative integer
- **Stable**: No (tracking issue: [#3349](https://github.com/rust-lang/rustfmt/issues/3349))

**Note:** A value of `0` results in [`wrap_comments`](#wrap_comments) being applied regardless of a line's width.
Expand Down Expand Up @@ -586,7 +586,7 @@ Note that this is not how much whitespace is inserted, but instead the longest v
doesn't get ignored when aligning.

- **Default value** : 0
- **Possible values**: any positive integer
- **Possible values**: any nonnegative integer
- **Stable**: No (tracking issue: [#3372](https://github.com/rust-lang/rustfmt/issues/3372))

#### `0` (default):
Expand Down Expand Up @@ -764,7 +764,7 @@ See also [`fn_params_layout`](#fn_params_layout)
Maximum width of the args of a function call before falling back to vertical formatting.

- **Default value**: `60`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Possible values**: any nonnegative integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: Yes

By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `fn_call_width` will take precedence.
Expand Down Expand Up @@ -1048,7 +1048,7 @@ fn add_one(x: i32) -> i32 {
Max width for code snippets included in doc comments. Only used if [`format_code_in_doc_comments`](#format_code_in_doc_comments) is true.

- **Default value**: `100`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Possible values**: any nonnegative integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: No (tracking issue: [#5359](https://github.com/rust-lang/rustfmt/issues/5359))

## `format_generated_files`
Expand All @@ -1067,7 +1067,7 @@ This option is currently ignored for stdin (`@generated` in stdin is ignored.)
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.

- **Default value**: `5`
- **Possible values**: any positive integer
- **Possible values**: any nonnegative integer
- **Stable**: No (tracking issue: [#5080](https://github.com/rust-lang/rustfmt/issues/5080))

See also [format_generated_files](#format_generated_files) link here.
Expand Down Expand Up @@ -1715,7 +1715,7 @@ fn lorem<Ipsum, Dolor, Sit, Amet>() -> T
Write an item and its attribute on the same line if their combined width is below a threshold

- **Default value**: 0
- **Possible values**: any positive integer
- **Possible values**: any nonnegative integer
- **Stable**: No (tracking issue: [#3343](https://github.com/rust-lang/rustfmt/issues/3343))

### Example
Expand Down Expand Up @@ -1939,7 +1939,7 @@ See also: [`trailing_comma`](#trailing_comma), [`match_arm_blocks`](#match_arm_b
Maximum width of each line

- **Default value**: `100`
- **Possible values**: any positive integer
- **Possible values**: any nonnegative integer
- **Stable**: Yes

See also [`error_on_line_overflow`](#error_on_line_overflow).
Expand Down Expand Up @@ -2515,7 +2515,7 @@ The layout of an array is dependent on the length of each of its elements.
If 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.

- **Default value**: `10`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Possible values**: any nonnegative integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: Yes

#### `10` (default):
Expand Down Expand Up @@ -2554,7 +2554,7 @@ Don't reformat out of line modules
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`.

- **Default value**: `50`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Possible values**: any nonnegative integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: Yes

By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `single_line_if_else_max_width` will take precedence.
Expand All @@ -2571,7 +2571,7 @@ Note this occurs when `use_small_heuristics` is set to `Off`.
By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `single_line_let_else_max_width` will take precedence.

- **Default value**: `50`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Possible values**: any nonnegative integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: Yes

#### `50` (default):
Expand Down Expand Up @@ -2815,7 +2815,7 @@ See also: [`indent_style`](#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`.

- **Default value**: `18`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Possible values**: any nonnegative integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: Yes

By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `struct_lit_width` will take precedence.
Expand All @@ -2827,7 +2827,7 @@ See also [`max_width`](#max_width), [`use_small_heuristics`](#use_small_heuristi
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`.

- **Default value**: `35`
- **Possible values**: any positive integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Possible values**: any nonnegative integer that is less than or equal to the value specified for [`max_width`](#max_width)
- **Stable**: Yes

By default this option is set as a percentage of [`max_width`](#max_width) provided by [`use_small_heuristics`](#use_small_heuristics), but a value set directly for `struct_variant_width` will take precedence.
Expand Down Expand Up @@ -2864,7 +2864,7 @@ Alternatively, you can use the `--style-edition` flag when running `rustfmt` dir
Number of spaces per tab

- **Default value**: `4`
- **Possible values**: any positive integer
- **Possible values**: any nonnegative integer
- **Stable**: Yes

#### `4` (default):
Expand Down
Loading