Skip to content

Commit d948bd5

Browse files
committed
chore(deps): bump perfectionist to KSXGitHub/perfectionist#52 head
PR 52 (`93cb529`) fixes four of the five `macro_argument_binding` bug classes filed earlier: - #415 — `debug_assert_*` trivial-comparison no longer flagged when the comparison is over side-effect-free operands. Removed function-scope `#[expect]` suppressions in `data_tree::hardlink`, `visualizer::methods::bar_table`, and `visualizer::methods::initial_table`. - #416 — `name = value` / `name += value` DSL matchers no longer flagged. Removed the function-scope suppression on `reporter::progress_and_error_reporter::report`. The narrower `->` / `in` separators used by `tests::bytes_format::test_case!` are not yet covered, so its crate-root suppression remains, with the reason updated to point at the partial fix. - #417 — unit literal `()` is now trivial. Removed the function-scope suppression on `app::App::run`. - #418 — bare operator tokens (`==`, `>`) used as positional separators in `debug_assert_op_expr!` are no longer flagged. The lone residual flag in `visualizer::methods::tree_table` (`debug_assert_op_expr!(intermediate_table.len(), ==, ...)`) is correct rule behaviour: the rule cannot prove `Vec::len` is pure. Replaced the broad suppression with a narrower one citing `Vec::len`'s `O(1)`-pure-read contract. PR 43, folded into PR 52's branch, splits `single_letter_names` into separate per-rule config keys. Migrate the `comparison_methods` allowlist from `[perfectionist::single_letter_names]` to the new `[perfectionist::single_letter_closure_param]` section so the project-specific `sort_reflection_by` / `into_sorted_by` helpers remain exempt from the closure-parameter check. https://claude.ai/code/session_01CoRidYHvni9nKNgxMPXmfQ
1 parent eec253d commit d948bd5

8 files changed

Lines changed: 4 additions & 39 deletions

File tree

dylint.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[workspace.metadata.dylint]
22
libraries = [
3-
{ git = "https://github.com/KSXGitHub/perfectionist", tag = "0.0.0-rc.9" },
3+
{ git = "https://github.com/KSXGitHub/perfectionist", rev = "93cb529c15ae9e0ac8ef093efee58219b8d68cb7" },
44
]
55

66
["perfectionist::derive_ordering"]
@@ -38,7 +38,7 @@ prefix = [
3838
"LowerHex", "UpperHex", "Octal",
3939
]
4040

41-
["perfectionist::single_letter_names"]
41+
["perfectionist::single_letter_closure_param"]
4242
# Treat project-specific and third-party comparison-style helpers as if
4343
# they were standard `sort_by`-shaped methods, so the idiomatic
4444
# `|a, b| a.field.cmp(&b.field)` closure does not trip the rule. The

src/app.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ impl App {
3939
}
4040

4141
/// 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",
47-
)
48-
)]
4942
pub fn run(mut self) -> Result<(), RuntimeError> {
5043
// DYNAMIC DISPATCH POLICY:
5144
//

src/data_tree/hardlink.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ where
1212
{
1313
/// Reduce the size of the directories that have hardlinks.
1414
#[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",
20-
)
21-
)]
2215
pub(crate) fn par_deduplicate_hardlinks(&mut self, hardlink_info: &[(Size, Vec<&Path>)]) {
2316
if hardlink_info.is_empty() {
2417
return;

src/reporter/progress_and_error_reporter.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,6 @@ where
7979
ReportError: Fn(ErrorReport) + Sync,
8080
u64: Into<Size>,
8181
{
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",
87-
)
88-
)]
8982
fn report(&self, event: Event<Size>) {
9083
use Event::*;
9184
let ProgressAndErrorReporter {

src/visualizer/methods/bar_table.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ pub(super) struct BarRow<Name, NodeData> {
1212
pub(super) proportion_bar: ProportionBar,
1313
}
1414

15-
#[cfg_attr(
16-
dylint_lib = "perfectionist",
17-
expect(
18-
perfectionist::macro_argument_binding,
19-
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)",
20-
)
21-
)]
2215
pub(super) fn render_bars<'a, Name, Size>(
2316
tree_table: TreeTable<&'a Name, Size>,
2417
total: u64,

src/visualizer/methods/initial_table.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ impl InitialColumnWidth {
3737
pub(super) type InitialTable<Name, NodeData> =
3838
Table<InitialRow<Name, NodeData>, InitialColumnWidth>;
3939

40-
#[cfg_attr(
41-
dylint_lib = "perfectionist",
42-
expect(
43-
perfectionist::macro_argument_binding,
44-
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",
45-
)
46-
)]
4740
pub(super) fn render_initial<Name, Size>(
4841
visualizer: Visualizer<'_, Name, Size>,
4942
) -> InitialTable<&'_ Name, Size>

src/visualizer/methods/tree_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub(super) type TreeTable<Name, NodeData> = Table<TreeRow<Name, NodeData>, TreeC
4545
dylint_lib = "perfectionist",
4646
expect(
4747
perfectionist::macro_argument_binding,
48-
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)",
48+
reason = "`Vec::len` is a pure `O(1)` read; the `debug_assert_op_expr!` invocation below intentionally keeps the call inside the assertion so it runs only in debug builds, and binding it to a `let` would lift the call into release builds for no benefit",
4949
)
5050
)]
5151
pub(super) fn render_tree<'a, Name, Size>(

tests/bytes_format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
dylint_lib = "perfectionist",
55
expect(
66
perfectionist::macro_argument_binding,
7-
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.",
7+
reason = "the `test_case!` macro uses a `name -> value in system == expected` DSL whose `->` and `in` separators are not yet recognised by the rule's non-expression marker list (PR #52 added `=`, `+=`, and bare operators but not these). 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 (#419).",
88
)
99
)]
1010

0 commit comments

Comments
 (0)