You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new rule `macro_argument_binding` flags 25 sites across the
codebase. Investigation showed every single one to be a false
positive belonging to one of five upstream bug classes, filed
as #415, #416, #417, #418, and #419. None of the suggested
"bind to a `let` first" fixes are correct here:
- The 13 `debug_assert_op!` / `debug_assert_op_expr!` sites
would have their arguments forced to run in release builds
(#415), defeating the entire point of `debug_assert_*`.
- The `make_const!` and `bump!` matchers (#416) use definition
/ compound-assignment shapes that have no `let`-binding form.
- `app::App::run` passes the unit literal `()`, which the
rule's grammar fails to recognise as trivial (#417).
- `debug_assert_op_expr!`'s middle operator argument (`==`,
`>`) is a bare token, not an expression at all (#418).
- The late pass anchors item-position macro violations at the
crate root (#419), which is why module-scope `#[expect]`
cannot suppress them and `proportion_bar.rs`'s `make_const!`
macro had to be expanded into five `pub const` lines by hand.
Apply `#[cfg_attr(dylint_lib = "perfectionist", expect(...))]`
at the smallest scope each false positive permits (function
scope where the macro call is statement-position, crate root
in `tests/bytes_format.rs` where the call is item-position).
Rewrite the `link!` / `symlink!` macros in `tests/_utils.rs`
as closures so the test-utility module needs no suppression.
https://claude.ai/code/session_01CoRidYHvni9nKNgxMPXmfQ
Copy file name to clipboardExpand all lines: src/app.rs
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,13 @@ impl App {
39
39
}
40
40
41
41
/// Run the application.
42
+
#[cfg_attr(
43
+
dylint_lib = "perfectionist",
44
+
expect(
45
+
perfectionist::macro_argument_binding,
46
+
reason = "the unit literal `()` is the canonical trivial value, but the rule's trivial-expression grammar does not yet accept parenthesised forms; see #417",
Copy file name to clipboardExpand all lines: src/data_tree/hardlink.rs
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,13 @@ where
12
12
{
13
13
/// Reduce the size of the directories that have hardlinks.
14
14
#[cfg_attr(not(unix), expect(unused))]
15
+
#[cfg_attr(
16
+
dylint_lib = "perfectionist",
17
+
expect(
18
+
perfectionist::macro_argument_binding,
19
+
reason = "binding a `debug_assert_op!` argument to a `let` forces it to run in release builds, which defeats the entire point of `debug_assert_*`; see #415",
Copy file name to clipboardExpand all lines: src/reporter/progress_and_error_reporter.rs
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,13 @@ where
79
79
ReportError:Fn(ErrorReport) + Sync,
80
80
u64:Into<Size>,
81
81
{
82
+
#[cfg_attr(
83
+
dylint_lib = "perfectionist",
84
+
expect(
85
+
perfectionist::macro_argument_binding,
86
+
reason = "the `bump!` macro's `($field:ident += $delta:expr)` matcher uses structural assignment syntax rather than a single expression, so binding the argument to a `let` is not even syntactically possible; see #416",
reason = "the flagged sites are all `debug_assert_op!` / `debug_assert_op_expr!` calls on side-effect-free locals; binding to a `let` would defeat the debug-only contract (see #415), and the rule also miscategorises bare operator tokens like `==` as expressions (see #418)",
reason = "the flagged sites are `debug_assert_op!` calls on side-effect-free locals; binding to a `let` would defeat the debug-only contract. See #415",
reason = "the flagged sites are `debug_assert_op!` / `debug_assert_op_expr!` calls; binding to a `let` would defeat the debug-only contract (see #415), and the rule miscategorises bare operator tokens like `==` and `>` as expressions (see #418)",
reason = "the `test_case!` macro uses a `name -> value in system == expected` DSL whose separators (`->`, `in`, `==`) are matcher tokens, not expression operators; binding the argument to a `let` is not even syntactically applicable. See #416. The crate-root scope is forced by an upstream late-pass anchoring quirk: violations in module-level item-position macro expansions resolve to the crate root, where finer-scoped `#[expect]` cannot reach them.",
8
+
)
9
+
)]
10
+
1
11
use parallel_disk_usage::bytes_format::BytesFormat;
0 commit comments