@neralabs/rerail-pack-rust 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +112 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,3 +86,115 @@ Scoring one rule with every false positive and false negative printed:
|
|
|
86
86
|
```sh
|
|
87
87
|
node --import tsx conformance/languages/cli.ts --pack rust --rule clippy-precedence --fixtures
|
|
88
88
|
```
|
|
89
|
+
|
|
90
|
+
## Rule details
|
|
91
|
+
|
|
92
|
+
What each rule matches beyond its one-line description: exact matching, edge cases, upstream settings and known divergences.
|
|
93
|
+
|
|
94
|
+
### `clippy-allow-attributes`
|
|
95
|
+
|
|
96
|
+
Port of Clippy 0.1.99's allow_attributes: reports the path of every outer #[allow(..)] attribute, one a #[cfg_attr(..)] expands to included. The lint needs Rust 1.81 (lint reasons, `suppress.clippy.msrv`). Inner #![allow] is not reported. What a macro invocation's or macro_rules! body's token tree holds, and whether a #[cfg] predicate holds in a build, are not read. A #[cfg_attr] is read as active unless its first argument is exactly `test`, `any()` or `not(clippy)`, the predicates the suppression engine reads as off whatever the build; every other predicate is read as active.
|
|
97
|
+
|
|
98
|
+
### `clippy-allow-attributes-without-reason`
|
|
99
|
+
|
|
100
|
+
Port of Clippy 0.1.99's allow_attributes_without_reason: reports every #[allow(..)] and #[expect(..)] attribute, inner or outer, one a #[cfg_attr(..)] expands to included (at the expanded attribute), whose last item is not `reason = ".."`. The lint needs Rust 1.81 (lint reasons, `suppress.clippy.msrv`). What a macro invocation's or macro_rules! body's token tree holds, and whether a #[cfg] predicate holds in a build, are not read. A #[cfg_attr] is read as active unless its first argument is exactly `test`, `any()` or `not(clippy)`, the predicates the suppression engine reads as off whatever the build; every other predicate is read as active. Each allow or expect a #[cfg_attr] expands to is checked on its own for a last `reason = ".."` item.
|
|
101
|
+
|
|
102
|
+
### `clippy-decimal-literal-representation`
|
|
103
|
+
|
|
104
|
+
Port of Clippy 0.1.99's decimal_literal_representation (literal-representation-threshold 16384, the default): reports a decimal integer literal whose value is at least the threshold and whose hexadecimal digits are a power of two with a margin (1, 2, 4 or 8 then zeros, or 1, 3, 7 or F then Fs, the last digit free) or only 0s and Fs after a leading 7 or F. Values of 2^52 and above are not read (the thresholds are JSON numbers); macro arguments and macro_rules! bodies are token trees no syntax-level reader expands.
|
|
105
|
+
|
|
106
|
+
### `clippy-decimal-literal-representation-threshold`
|
|
107
|
+
|
|
108
|
+
Port of Clippy 0.1.99's decimal_literal_representation under literal-representation-threshold = 0xFFFFFF (its ui-toml test): reports a decimal integer literal whose value is at least the threshold and whose hexadecimal digits are a power of two with a margin (1, 2, 4 or 8 then zeros, or 1, 3, 7 or F then Fs, the last digit free) or only 0s and Fs after a leading 7 or F. Values of 2^52 and above are not read (the thresholds are JSON numbers); macro arguments and macro_rules! bodies are token trees no syntax-level reader expands.
|
|
109
|
+
|
|
110
|
+
### `clippy-double-parens`
|
|
111
|
+
|
|
112
|
+
Port of Clippy 0.1.99's double_parens lint: reports redundant nested parentheses around an expression (only whitespace between the two opening or closing parentheses, as Clippy's source check requires; a call's sole argument in parentheses, reported once where the nested-parentheses clauses already report the same span); macro expansion and tuple/unit argument semantics are not modelled.
|
|
113
|
+
|
|
114
|
+
### `clippy-inconsistent-digit-grouping`
|
|
115
|
+
|
|
116
|
+
Port of Clippy 0.1.99's inconsistent_digit_grouping: reports a decimal literal whose integer part or fraction has groups of different sizes after the first (or a first group longer than the rest), or whose integer and fraction are grouped differently. Literals Clippy reads as a mistyped suffix (an unsuffixed literal ending in `_8`, `_16`, `_32` or `_64`, the exponent's `_32` or `_64`) and hexadecimal UUIDs (8-4-4-4-12) are not reported, nor (as Clippy skips code from expansion) literals in a macro_rules! body; a macro invocation's arguments keep their own spans and are read.
|
|
117
|
+
|
|
118
|
+
### `clippy-inconsistent-digit-grouping-no-fractions`
|
|
119
|
+
|
|
120
|
+
Port of Clippy 0.1.99's inconsistent_digit_grouping under unreadable-literal-lint-fractions = false (its ui-toml test): reports a decimal literal whose integer part or fraction has groups of different sizes after the first (or a first group longer than the rest), or whose integer and fraction are grouped differently (unreadable-literal-lint-fractions = false: a fraction is never unreadable). Literals Clippy reads as a mistyped suffix (an unsuffixed literal ending in `_8`, `_16`, `_32` or `_64`, the exponent's `_32` or `_64`) and hexadecimal UUIDs (8-4-4-4-12) are not reported, nor (as Clippy skips code from expansion) literals in a macro_rules! body; a macro invocation's arguments keep their own spans and are read.
|
|
121
|
+
|
|
122
|
+
### `clippy-int-plus-one`
|
|
123
|
+
|
|
124
|
+
Port of Clippy 0.1.99's int_plus_one lint: reports inequalities equivalent to a strict comparison through addition or subtraction by one; constant evaluation and type semantics are not modelled.
|
|
125
|
+
|
|
126
|
+
### `clippy-large-digit-groups`
|
|
127
|
+
|
|
128
|
+
Port of Clippy 0.1.99's large_digit_groups: reports a decimal literal whose integer part, or else its fraction (grouped from the right), is grouped consistently in groups longer than four digits. Literals Clippy reads as a mistyped suffix (an unsuffixed literal ending in `_8`, `_16`, `_32` or `_64`, the exponent's `_32` or `_64`) and hexadecimal UUIDs (8-4-4-4-12) are not reported, nor (as Clippy skips code from expansion) literals in a macro_rules! body; a macro invocation's arguments keep their own spans and are read.
|
|
129
|
+
|
|
130
|
+
### `clippy-many-single-char-names`
|
|
131
|
+
|
|
132
|
+
Port of Clippy 0.1.99's many_single_char_names (threshold 4): in a function with a body (not a trait's default method, not #[test]), Clippy stacks the single-character, non-uppercase, non-underscore names its parameters, `let` patterns and match arm patterns bind (`binds`), a block or arm opening a scope, a name already stacked not again; the lint fires where a scope ends holding one of them and the stack holds more than four, at the stack's first name. This port reports at the function's first such name at its own level, where the function's level holds five, or a block or arm after that name holds one and, with the names before it, five; a function whose own level binds none is not reported. Shorthand struct fields, `if let`, `while let`, `for` and closure parameters bind nothing Clippy counts; macro arguments are token trees.
|
|
133
|
+
|
|
134
|
+
### `clippy-mixed-case-hex-literals`
|
|
135
|
+
|
|
136
|
+
Port of Clippy 0.1.99's mixed_case_hex_literals: reports a hexadecimal integer literal whose digits (after `0x`, before the type suffix and the `_` before it) hold both a lowercase and an uppercase letter. A type suffix starts with `i` or `u`, which no digit run crosses.
|
|
137
|
+
|
|
138
|
+
### `clippy-needless-else`
|
|
139
|
+
|
|
140
|
+
Port of Clippy 0.1.99's needless_else lint: reports an empty else block after an if statement when it has no meaningful comment or code; macro and cfg expansion are not modelled.
|
|
141
|
+
|
|
142
|
+
### `clippy-needless-raw-string-hashes`
|
|
143
|
+
|
|
144
|
+
Port of Clippy 0.1.99's needless_raw_string_hashes: reports a raw string, byte string or C string literal (up to ten hashes) holding a `\\` or a `"`, whose hashes exceed what its contents require: one more than the most hashes after a quote that starts a run (a quote right after a run's hashes ends it instead). A raw literal holding neither is needless_raw_strings', which the recording enables and which then takes it.
|
|
145
|
+
|
|
146
|
+
### `clippy-needless-raw-string-hashes-one-allowed`
|
|
147
|
+
|
|
148
|
+
Port of Clippy 0.1.99's needless_raw_string_hashes under allow-one-hash-in-raw-strings = true (its ui-toml test): reports a raw string, byte string or C string literal (up to ten hashes) holding a `\\` or a `"`, whose hashes exceed what its contents require: one more than the most hashes after a quote that starts a run (a quote right after a run's hashes ends it instead). One hash is always allowed. A raw literal holding neither is needless_raw_strings', which the recording enables and which then takes it.
|
|
149
|
+
|
|
150
|
+
### `clippy-needless-raw-strings`
|
|
151
|
+
|
|
152
|
+
Port of Clippy 0.1.99's needless_raw_strings: reports raw literals whose contents do not require raw-string syntax or hashes; macro expansion and format-string preprocessing are not modelled.
|
|
153
|
+
|
|
154
|
+
### `clippy-octal-escapes`
|
|
155
|
+
|
|
156
|
+
Port of Clippy 0.1.99's octal_escapes: reports each \0 followed by one or two octal digits in string, byte-string, or C-string literals; format-string preprocessing and external macros are not modelled.
|
|
157
|
+
|
|
158
|
+
### `clippy-partial-pub-fields`
|
|
159
|
+
|
|
160
|
+
Port of Clippy 0.1.99's partial_pub_fields: in a struct whose first field is `pub` (exactly: `pub(crate)` and other restricted visibilities are not), reports the first field that is not, and in one whose first field is not `pub`, the first field that is, at the field's visibility (its start when it has none).
|
|
161
|
+
|
|
162
|
+
### `clippy-precedence`
|
|
163
|
+
|
|
164
|
+
Port of Clippy 0.1.99's precedence lint: reports a shift or bitwise operation whose operand is an unparenthesized arithmetic (+ - * / %) operation, at every nesting depth; macro expansion and type/value semantics are not modelled.
|
|
165
|
+
|
|
166
|
+
### `clippy-precedence-bits`
|
|
167
|
+
|
|
168
|
+
Port of Clippy 0.1.99's precedence_bits lint: reports, at any nesting depth, a bitwise (& | ^) operation with an unparenthesized shift operand and no unparenthesized arithmetic operand (that mix is the precedence lint's). Clippy reports every such operation, but operations sharing a start (a left-nested chain like `a ^ b ^ c >> 1 ^ d >> 2`) are one position, so one finding is made per chain, at the outermost operation; macro expansion and semantic type checks are not modelled.
|
|
169
|
+
|
|
170
|
+
### `clippy-redundant-field-names`
|
|
171
|
+
|
|
172
|
+
Port of Clippy 0.1.99's redundant_field_names: reports a struct expression's field initializer whose value is a path of one segment, without generic arguments, naming the field (`S { a: a }`). The lint needs Rust 1.17 (field init shorthand, `suppress.clippy.msrv`). Macro arguments and macro_rules! bodies are token trees no syntax-level reader expands.
|
|
173
|
+
|
|
174
|
+
### `clippy-redundant-static-lifetimes`
|
|
175
|
+
|
|
176
|
+
Port of Clippy 0.1.99's redundant_static_lifetimes: reports redundant 'static lifetimes in free const and static declarations, where Clippy's visit_type reaches them (through references, arrays, slices and tuples, not into fn-pointer, generic-argument or trait-object types); associated items are not modelled. The lint needs Rust 1.17 (`suppress.clippy.msrv`).
|
|
177
|
+
|
|
178
|
+
### `clippy-single-char-lifetime-names`
|
|
179
|
+
|
|
180
|
+
Port of Clippy 0.1.99's single_char_lifetime_names: reports each single-character lifetime parameter where it is declared, a generic parameter list's or a `for<..>` binder's, not where a bound or a type names it. Macro arguments and macro_rules! bodies are token trees no syntax-level reader expands.
|
|
181
|
+
|
|
182
|
+
### `clippy-single-component-path-imports`
|
|
183
|
+
|
|
184
|
+
Port of Clippy 0.1.99's single_component_path_imports (Rust 2018 and later): reports a module's (the file's or a `mod`'s) non-`pub` `use name;` without a rename, and each `name` of a `use {a, b};` without a prefix, unless a `macro_rules!` of that name comes before it in the module, a non-`pub` `use self::name..` of the module (or `use self::{name..}`) names it, or a path `self::name::..` outside `use` declarations does anywhere in the module. Clippy reads the module after macro expansion; macro arguments and macro_rules! bodies are token trees no syntax-level reader expands.
|
|
185
|
+
|
|
186
|
+
### `clippy-unnested-or-patterns`
|
|
187
|
+
|
|
188
|
+
Port of Clippy 0.1.99's unnested_or_patterns: reports a match arm's, let's, if/while let's or parameter's pattern that holds an or-pattern Clippy nests: one with a parenthesised or-pattern among its alternatives, or with two alternatives (adjacent or not) built alike that differ in one sub-pattern at most: `&mut`, the same `x @`, `ref x @` or `mut x @` binding, a tuple, slice or tuple struct (same path) pattern whose differing element is not `..` on either side, among the first six, or a struct pattern (same path, both with or both without `..`, up to six fields in any order) whose other fields are the same, unless the two are the same shorthands only. The lint needs Rust 1.53 (`suppress.clippy.msrv`). Sub-patterns compare by their tokens, parentheses included. Macro arguments and macro_rules! bodies are token trees no syntax-level reader expands; `box` patterns (an unstable feature) do not parse.
|
|
189
|
+
|
|
190
|
+
### `clippy-unreadable-literal`
|
|
191
|
+
|
|
192
|
+
Port of Clippy 0.1.99's unreadable_literal: reports an integer or float literal whose digits, as Clippy's NumericLiteral splits them (radix prefix, suffix and the `_` before it, integer, fraction and exponent), hold an ungrouped part longer than five digits (a decimal integer part, a fraction, or a binary, octal or hexadecimal literal whose first group is). Literals Clippy reads as a mistyped suffix (an unsuffixed literal ending in `_8`, `_16`, `_32` or `_64`, the exponent's `_32` or `_64`) and hexadecimal UUIDs (8-4-4-4-12) are not reported, nor (as Clippy skips code from expansion) literals in a macro_rules! body; a macro invocation's arguments keep their own spans and are read.
|
|
193
|
+
|
|
194
|
+
### `clippy-unreadable-literal-no-fractions`
|
|
195
|
+
|
|
196
|
+
Port of Clippy 0.1.99's unreadable_literal under unreadable-literal-lint-fractions = false (its ui-toml test): reports an integer or float literal whose digits, as Clippy's NumericLiteral splits them (radix prefix, suffix and the `_` before it, integer, fraction and exponent), hold an ungrouped part longer than five digits (a decimal integer part, a fraction (never, under unreadable-literal-lint-fractions = false), or a binary, octal or hexadecimal literal whose first group is). Literals Clippy reads as a mistyped suffix (an unsuffixed literal ending in `_8`, `_16`, `_32` or `_64`, the exponent's `_32` or `_64`) and hexadecimal UUIDs (8-4-4-4-12) are not reported, nor (as Clippy skips code from expansion) literals in a macro_rules! body; a macro invocation's arguments keep their own spans and are read.
|
|
197
|
+
|
|
198
|
+
### `clippy-unusual-byte-groupings`
|
|
199
|
+
|
|
200
|
+
Port of Clippy 0.1.99's unusual_byte_groupings: reports a binary, octal or hexadecimal literal whose digit groups after the first differ in size, or whose first group is longer than the rest. Literals Clippy reads as a mistyped suffix (an unsuffixed literal ending in `_8`, `_16`, `_32` or `_64`, the exponent's `_32` or `_64`) and hexadecimal UUIDs (8-4-4-4-12) are not reported, nor (as Clippy skips code from expansion) literals in a macro_rules! body; a macro invocation's arguments keep their own spans and are read.
|