Skip to content

chore(deps): upgrade perfectionist#407

Merged
KSXGitHub merged 7 commits into
masterfrom
claude/upgrade-perfectionist-pywcA
May 11, 2026
Merged

chore(deps): upgrade perfectionist#407
KSXGitHub merged 7 commits into
masterfrom
claude/upgrade-perfectionist-pywcA

Conversation

@KSXGitHub
Copy link
Copy Markdown
Owner

@KSXGitHub KSXGitHub commented May 11, 2026

Summary

Bump perfectionist from 0.0.0-rc.0 to 0.0.0-rc.7, fix the new violations, drop a guideline made redundant by the new rules, and enforce dylint warnings as CI errors.

New rules in rc.7

  • flat_module_pattern — forbids module/mod.rs.
  • macro_trailing_comma — multi-line macro invocations require a trailing comma; single-line ones forbid it. (0.0.0-rc.7 skips rustfmt-compatible compact vec![Single { … }] layouts and properly fulfills cfg_attr-gated #[expect].)
  • unicode_ellipsis_in_panic_messages — forbids in panic/assert/expect strings.
  • unknown_perfectionist_lints — flags typos in perfectionist::… attributes.

(unicode_ellipsis_in_comments already existed in rc.0.)

Changes

  • dylint.toml — pin 0.0.0-rc.7.
  • test.sh — pass RUSTFLAGS="-D warnings" to cargo dylint so any rule violation now fails the script, matching cargo clippy's behaviour.
  • Code — fix all macro_trailing_comma warnings across src/app/hdd.rs, src/app/hdd/test_linux_smoke.rs, src/app/overlapping_arguments/test_remove_overlapping_paths.rs, src/hardlink/hardlink_list/summary.rs, src/man_page.rs, tests/cli_errors.rs, and tests/one_file_system.rs. The two tests/tree_builder.rs / tests/visualizer.rs sites that previously needed suppression are now silent because rc.7 skips their vec![Single { … }] shape — no suppression scaffolding is needed.
  • CONTRIBUTING.md — drop the "Use the flat file pattern (module.rs) rather than module/mod.rs" bullet, which perfectionist::flat_module_pattern now enforces, and adjust the Code Style preamble so the manual-vs-enforced split is consistent across subsections.
  • .github/workflows/dylint.yaml — invalidate target/dylint only when the actions/cache step reported a non-exact restore (cache-hit != 'true'). The cached libperfectionist.so does not always get rebuilt when only dylint.toml changes, so a stale lib from the previous dylint.toml revision can re-fire rules that the new revision was supposed to skip. The ~/.cargo registry cache and ~/.dylint_drivers driver are kept regardless of cache-hit state.

Two upstream bug reports were filed as #408 and #409 documenting the rustfmt-contradicting behaviour and the #[expect] short-circuit; 0.0.0-rc.7 resolves both.

Test plan

  • FMT=true LINT=true BUILD=true TEST=true DOC=true DYLINT=true TEST_SKIP='fs_errors cross_device_excludes_mount' ./test.sh — passes locally (fs_errors skipped because the sandbox runs as root; cross_device_excludes_mount skipped because squashfs-tools / squashfuse / fuse3 are not installed).
  • CI runs the same suite with FUSE tooling installed and as a non-root user.

The new release adds the `flat_module_pattern`, `macro_trailing_comma`,
`unicode_ellipsis_in_panic_messages`, and `unknown_perfectionist_lints`
rules. Fix the trailing-comma violations the new rule reports and drop
the now-redundant flat-module-pattern bullet from `CONTRIBUTING.md`.

Two `macro_trailing_comma` warnings remain in `tests/tree_builder.rs`
and `tests/visualizer.rs`. They are triggered by single-element
multi-line `vec!` invocations that `rustfmt` actively reformats away
from a trailing comma, and `#[allow(perfectionist::...)]` cannot be
used without nightly `register_tool`. The warnings do not fail the
build because `test.sh` does not pass `-D warnings` to `cargo dylint`.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Upgrades the perfectionist dylint dependency to 0.0.0-rc.6 and updates code/documentation to comply with the newly enforced lint rules (notably macro_trailing_comma), while trimming CONTRIBUTING guidance now covered by the linter.

Changes:

  • Bump perfectionist in dylint.toml from 0.0.0-rc.0 to 0.0.0-rc.6.
  • Add/update trailing commas in multi-line macro invocations across tests and Rust sources to satisfy macro_trailing_comma.
  • Update CONTRIBUTING.md module-organization guidance to reflect enforcement by perfectionist::flat_module_pattern.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dylint.toml Pins the workspace dylint library perfectionist to 0.0.0-rc.6.
CONTRIBUTING.md Updates module organization guidance to reflect linter enforcement.
src/app/hdd.rs Adjusts matches! macro formatting to include required trailing commas.
src/app/hdd/test_linux_smoke.rs Adds required trailing comma in a multi-line assert! invocation.
src/app/overlapping_arguments/test_remove_overlapping_paths.rs Adds required trailing commas for multi-line macro invocations (dbg!, vec!).
src/hardlink/hardlink_list/summary.rs Adds required trailing comma in a multi-line panic! invocation.
src/man_page.rs Adds required trailing comma in a multi-line matches! invocation.
tests/cli_errors.rs Adds required trailing commas around multi-line macro invocations (text_block! inside assert_eq!).
tests/one_file_system.rs Adds required trailing comma in a multi-line assert! invocation.

Comment thread CONTRIBUTING.md
Address Copilot review on #407: the Code Style preamble said
conventions are not enforced by tooling, which contradicted the new
note that  enforces the flat file
pattern. Reword the preamble so dylint is acknowledged alongside fmt
and clippy and so the manual-vs-enforced split is consistent across
subsections.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

Performance Regression Reports

commit: 61c2974

There are no regressions.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

Pass RUSTFLAGS="-D warnings" to cargo dylint so any rule violation now
fails the script, matching what cargo clippy already does. Suppress the
two known macro_trailing_comma sites in tests/tree_builder.rs and
tests/visualizer.rs via crate-level cfg_attr-gated attributes:

* Gate everything on cfg(dylint_lib = "perfectionist") so the
  attributes only apply during dylint runs (the cfg is set by dylint's
  RUSTC wrapper). This keeps stable cargo check untouched and matches
  the user preference for narrow handling of unknown_tool, since
  perfectionist is registered as a tool only when dylint is active.
* register_tool(perfectionist) under #![feature(register_tool)] makes
  rustc accept the perfectionist:: lint prefix on the nightly toolchain
  that dylint uses, avoiding E0710.
* Use expect rather than allow for macro_trailing_comma per project
  preference, with an accompanying allow(unfulfilled_lint_expectations)
  because perfectionist appears to short-circuit when its lint is
  expected at crate scope, leaving the expect unfulfilled despite
  actual violations.
* allow(unexpected_cfgs) covers the dylint_lib cfg name itself, which
  rustc does not learn from --check-cfg.
claude added 3 commits May 11, 2026 16:23
PR #25 (commit d8c545f) fixes both issues filed in #408 and #409:
macro_trailing_comma now skips rustfmt-compatible compact layouts
(single-element multi-line bracket macros) and properly fulfills
cfg_attr-gated expects.

* Drop the crate-level suppression scaffolding in
  tests/tree_builder.rs and tests/visualizer.rs: the rule no longer
  fires on vec![Single { ... }] / vec![single(...)] shapes that
  rustfmt actively collapses.
* Drop the trailing commas added to dbg!(vec![...]) call sites in
  test_remove_overlapping_paths.rs, which fell into the same
  compact-layout category and are no longer flagged.

The single-argument multi-line panic! in
src/hardlink/hardlink_list/summary.rs still requires the trailing
comma because PR #25 only relaxes the rule for bracket-delimited
compact layouts, not parenthesised single-argument macros.
The `Dylint` workflow's cache `restore-keys` list ends with a key that
matches any prior cache for the same `rust-toolchain`, ignoring the
`dylint.toml` hash. When `dylint.toml` changes the cached
`target/dylint/libraries/libperfectionist.so` is the lib built from
the previous `dylint.toml`. `cargo dylint` does not always detect a
changed `git`/`rev` and reuses the cached `.so` instead of rebuilding.
With `RUSTFLAGS="-D warnings"` enforced, the stale lib re-flags sites
that the current `dylint.toml` revision is supposed to skip, failing
the job.

Add a step between the cache restore and the dylint run that deletes
`target/dylint`. The `~/.cargo` registry cache stays intact, so
dependency downloads remain fast, while the perfectionist library is
always rebuilt from the `dylint.toml` currently in tree.

Reproducible locally by switching `dylint.toml` between the
`0.0.0-rc.6` tag and the `KSXGitHub/perfectionist#25` rev without
clearing `target/dylint` between runs.
Only delete `target/dylint` when `actions/cache` reported a primary-key
miss. The `cache-hit` output is `true` only when the exact `key`
matched, which means the cached `target/dylint/libraries/...so` was
built for the current `dylint.toml`. Any `restore-keys` fallback
(including the looser third entry that ignores `dylint.toml`) leaves
`cache-hit` as `false`, and that is the case where the cached `.so`
may not match the in-tree `dylint.toml`. Always running the cleanup
needlessly rebuilds the perfectionist library and its dependency
chain on every run, which makes the `target` portion of the cache
useless.

This comment was marked as resolved.

`0.0.0-rc.7` ships the same fixes as the PR-25 head this branch was
pointing at: `macro_trailing_comma` skips rustfmt-compatible compact
layouts and properly fulfills `cfg_attr`-gated `#[expect]`. Switch
`dylint.toml` from the unstable `rev` pin to the released tag.
@KSXGitHub KSXGitHub marked this pull request as ready for review May 11, 2026 17:03
@KSXGitHub KSXGitHub merged commit 145bb5b into master May 11, 2026
15 checks passed
@KSXGitHub KSXGitHub deleted the claude/upgrade-perfectionist-pywcA branch May 11, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants