chore(deps): upgrade perfectionist#407
Merged
Merged
Conversation
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`.
Contributor
There was a problem hiding this comment.
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
perfectionistindylint.tomlfrom0.0.0-rc.0to0.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.mdmodule-organization guidance to reflect enforcement byperfectionist::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. |
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.
Performance Regression Reportscommit: 61c2974 There are no regressions. |
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.
perfectionist to 0.0.0-rc.6perfectionist
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.
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bump
perfectionistfrom0.0.0-rc.0to0.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— forbidsmodule/mod.rs.macro_trailing_comma— multi-line macro invocations require a trailing comma; single-line ones forbid it. (0.0.0-rc.7skips rustfmt-compatible compactvec![Single { … }]layouts and properly fulfillscfg_attr-gated#[expect].)unicode_ellipsis_in_panic_messages— forbids…in panic/assert/expect strings.unknown_perfectionist_lints— flags typos inperfectionist::…attributes.(
unicode_ellipsis_in_commentsalready existed in rc.0.)Changes
dylint.toml— pin0.0.0-rc.7.test.sh— passRUSTFLAGS="-D warnings"tocargo dylintso any rule violation now fails the script, matchingcargo clippy's behaviour.macro_trailing_commawarnings acrosssrc/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, andtests/one_file_system.rs. The twotests/tree_builder.rs/tests/visualizer.rssites that previously needed suppression are now silent because rc.7 skips theirvec![Single { … }]shape — no suppression scaffolding is needed.CONTRIBUTING.md— drop the "Use the flat file pattern (module.rs) rather thanmodule/mod.rs" bullet, whichperfectionist::flat_module_patternnow enforces, and adjust theCode Stylepreamble so the manual-vs-enforced split is consistent across subsections..github/workflows/dylint.yaml— invalidatetarget/dylintonly when theactions/cachestep reported a non-exact restore (cache-hit != 'true'). The cachedlibperfectionist.sodoes not always get rebuilt when onlydylint.tomlchanges, so a stale lib from the previousdylint.tomlrevision can re-fire rules that the new revision was supposed to skip. The~/.cargoregistry cache and~/.dylint_driversdriver 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.7resolves 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_errorsskipped because the sandbox runs as root;cross_device_excludes_mountskipped becausesquashfs-tools/squashfuse/fuse3are not installed).