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
Bump the dylint library tag from `0.0.0-rc.17` to `0.0.0-rc.18` and
bring the tree into compliance with the rules it adds or extends:
- `import_grouping` (new, active): configured for the `single_group`
style. Blank lines that split an import run are removed so each
module keeps one contiguous `use` block.
- `bare_identifier_reference` (new, active): backticked identifiers in
doc comments that resolve in scope are now written as intra-doc
links.
- `prefer_expect_over_allow` (new, active): the `clippy::float_cmp`
suppressions in the fraction tests switch from `#[allow]` to
`#[expect]`.
- `prefer_raw_string` (bug fix#233): the rule now scans macro
arguments, so the roff `write!`/`format!` strings in `man_page`
become raw strings. The rendered man page is byte-for-byte
unchanged.
The `single_group` style cannot keep `#[cfg]`-gated imports in their
own trailing group, so files that rely on that layout carry a
module-level `#[expect(perfectionist::import_grouping)]`. This
limitation is tracked in #436.
https://claude.ai/code/session_016ZyYFnzSv876usUHLEX4qe
Import granularity is enforced automatically by the `perfectionist::import_granularity` rule, configured for the `module` style. Items from the same module are merged into a single braced `use` statement, while each module keeps its own `use` statement rather than collapsing an entire crate into one nested-braces statement. Import ordering is enforced separately by `cargo fmt`.
39
+
Two `perfectionist` rules govern imports automatically:
40
40
41
-
The remaining convention is not enforced and must be applied by hand. Imports gated by a platform attribute such as `#[cfg(unix)]` go in a separate block after the main imports.
41
+
-`perfectionist::import_granularity`, configured for the `module` style, controls how items are merged within each `use` statement. Items from the same module are merged into a single braced `use` statement, while each module keeps its own `use` statement rather than collapsing an entire crate into one nested-braces statement.
42
+
-`perfectionist::import_grouping`, configured for the `single_group` style, controls how `use` statements are partitioned into blocks. Every `use` statement, whether a `pub use` re-export or a private import, sits in one contiguous block with no blank lines between them.
43
+
44
+
Import ordering within the block is enforced separately by `cargo fmt`.
45
+
46
+
Imports gated by a platform or feature attribute such as `#[cfg(unix)]` are kept in their own block after the main imports, separated by a blank line. The `single_group` style cannot yet express this exception, so each file that uses it carries a module-level suppression. See [issue #436](https://github.com/KSXGitHub/parallel-disk-usage/issues/436).
42
47
43
48
```rust
49
+
#![cfg_attr(
50
+
dylint_lib ="perfectionist",
51
+
expect(
52
+
perfectionist::import_grouping,
53
+
reason ="single_group cannot keep #[cfg]-gated imports in their own trailing group; see issue #436"
54
+
)
55
+
)]
56
+
44
57
usecrate::args::{Args, Quantity, Threads};
45
58
usecrate::bytes_format::BytesFormat;
46
59
usecrate::size;
@@ -57,7 +70,7 @@ use crate::get_size::{GetBlockCount, GetBlockSize};
57
70
58
71
The flat file pattern (`module.rs` rather than `module/mod.rs`) is enforced by the `perfectionist::flat_module_pattern` dylint check. In addition to that requirement, follow these conventions:
59
72
60
-
- List `pub mod` declarations first, then `pub use` re-exports, then private importsand items.
73
+
- List `pub mod` declarations first, followed by the `use` block, then the remaining items. The `use` block holds both `pub use` re-exports and private imports; `cargo fmt`and `perfectionist::import_grouping` keep them in one sorted group, so do not rely on a fixed order between the two kinds.
61
74
- Use `pub use` to re-export key types at the module level for convenience.
0 commit comments