Skip to content

Commit 96608ea

Browse files
committed
lint: keep pub use re-exports in their own import group
`import_grouping_mismatch` partitions imports by path, not visibility, so under `single_block` it cannot keep `pub use` re-exports separate from private `use` imports. Restore the dedicated re-export group in each affected module and suppress the lint there with a module-level `#[expect]`. Tracked in #442. https://claude.ai/code/session_016ZyYFnzSv876usUHLEX4qe
1 parent bcd06f1 commit 96608ea

11 files changed

Lines changed: 117 additions & 18 deletions

File tree

src/app.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
#![cfg_attr(
2+
dylint_lib = "perfectionist",
3+
expect(
4+
perfectionist::import_grouping_mismatch,
5+
reason = "pub use re-exports are kept in their own group; see #442"
6+
)
7+
)]
8+
19
pub mod sub;
210

11+
pub use sub::Sub;
12+
313
use crate::args::{Args, Quantity, Threads};
414
use crate::bytes_format::BytesFormat;
515
use crate::device::DeviceBoundary;
@@ -15,7 +25,6 @@ use pipe_trait::Pipe;
1525
use std::io::stdin;
1626
use std::time::Duration;
1727
use sub::JsonOutputParam;
18-
pub use sub::Sub;
1928
use sysinfo::{Disk, Disks};
2029

2130
#[cfg(unix)]

src/args.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1+
#![cfg_attr(
2+
dylint_lib = "perfectionist",
3+
expect(
4+
perfectionist::import_grouping_mismatch,
5+
reason = "pub use re-exports are kept in their own group; see #442"
6+
)
7+
)]
8+
19
pub mod depth;
210
pub mod fraction;
311
pub mod quantity;
412
pub mod threads;
513

14+
pub use depth::Depth;
15+
pub use fraction::Fraction;
16+
pub use quantity::Quantity;
17+
pub use threads::Threads;
18+
619
use crate::bytes_format::BytesFormat;
720
use crate::visualizer::ColumnWidthDistribution;
821
use clap::{ColorChoice, Parser};
9-
pub use depth::Depth;
1022
use derive_setters::Setters;
11-
pub use fraction::Fraction;
12-
pub use quantity::Quantity;
1323
use smart_default::SmartDefault;
1424
use std::path::PathBuf;
1525
use terminal_size::{Width, terminal_size};
1626
use text_block_macros::text_block;
17-
pub use threads::Threads;
1827

1928
/// The CLI arguments.
2029
#[derive(Debug, SmartDefault, Clone, Parser, Setters)]

src/bytes_format.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#![cfg_attr(
2+
dylint_lib = "perfectionist",
3+
expect(
4+
perfectionist::import_grouping_mismatch,
5+
reason = "pub use re-exports are kept in their own group; see #442"
6+
)
7+
)]
8+
19
pub mod formatter;
210
pub mod output;
311
pub mod parsed_value;
@@ -6,6 +14,7 @@ pub mod scale_base;
614
pub use formatter::Formatter;
715
pub use output::Output;
816
pub use parsed_value::ParsedValue;
17+
918
use pipe_trait::Pipe;
1019

1120
#[cfg(feature = "cli")]

src/data_tree.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
#![cfg_attr(
2+
dylint_lib = "perfectionist",
3+
expect(
4+
perfectionist::import_grouping_mismatch,
5+
reason = "pub use re-exports are kept in their own group; see #442"
6+
)
7+
)]
8+
19
pub mod reflection;
210

3-
use super::size;
411
pub use Reflection as DataTreeReflection;
512
pub use reflection::Reflection;
613

14+
use super::size;
15+
716
/// Disk usage data of a filesystem tree.
817
///
918
/// **Construction:** There are 3 main ways to create a [`DataTree`]:

src/hardlink/hardlink_list.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1+
#![cfg_attr(
2+
dylint_lib = "perfectionist",
3+
expect(
4+
perfectionist::import_grouping_mismatch,
5+
reason = "pub use re-exports are kept in their own group; see #442"
6+
)
7+
)]
8+
19
pub mod iter;
210
pub mod reflection;
311
pub mod summary;
412

13+
pub use Reflection as HardlinkListReflection;
14+
pub use Summary as SharedLinkSummary;
15+
pub use iter::Iter;
16+
pub use reflection::Reflection;
17+
pub use summary::Summary;
18+
519
use crate::device::DeviceNumber;
620
use crate::hardlink::LinkPathList;
721
use crate::inode::InodeNumber;
822
use crate::size;
9-
pub use Reflection as HardlinkListReflection;
10-
pub use Summary as SharedLinkSummary;
1123
use dashmap::DashMap;
1224
use derive_more::{Display, Error};
13-
pub use iter::Iter;
14-
pub use reflection::Reflection;
1525
use smart_default::SmartDefault;
1626
use std::fmt::Debug;
17-
pub use summary::Summary;
1827

1928
#[cfg(any(unix, test))]
2029
use pipe_trait::Pipe;

src/hardlink/link_path_list.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
#![cfg_attr(
2+
dylint_lib = "perfectionist",
3+
expect(
4+
perfectionist::import_grouping_mismatch,
5+
reason = "pub use re-exports are kept in their own group; see #442"
6+
)
7+
)]
8+
19
mod iter;
210
mod reflection;
311

412
pub use Reflection as LinkPathListReflection;
513
pub use iter::Iter;
614
pub use reflection::Reflection;
15+
716
use std::path::PathBuf;
817

918
/// List of different hardlinks to the same file.

src/json_data.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1+
#![cfg_attr(
2+
dylint_lib = "perfectionist",
3+
expect(
4+
perfectionist::import_grouping_mismatch,
5+
reason = "pub use re-exports are kept in their own group; see #442"
6+
)
7+
)]
8+
19
pub mod binary_version;
210
pub mod schema_version;
311

12+
pub use binary_version::BinaryVersion;
13+
pub use schema_version::SchemaVersion;
14+
415
use crate::data_tree::DataTreeReflection;
516
use crate::hardlink::{HardlinkListReflection, SharedLinkSummary};
617
use crate::size::{self, Blocks, Bytes};
7-
pub use binary_version::BinaryVersion;
818
use derive_more::{Deref, DerefMut, From, TryInto};
9-
pub use schema_version::SchemaVersion;
1019
use smart_default::SmartDefault;
1120

1221
#[cfg(feature = "json")]

src/reporter.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1+
#![cfg_attr(
2+
dylint_lib = "perfectionist",
3+
expect(
4+
perfectionist::import_grouping_mismatch,
5+
reason = "pub use re-exports are kept in their own group; see #442"
6+
)
7+
)]
8+
19
pub mod error_only_reporter;
210
pub mod error_report;
311
pub mod event;
412
pub mod progress_and_error_reporter;
513
pub mod progress_report;
614

7-
use crate::size;
815
pub use error_only_reporter::ErrorOnlyReporter;
916
pub use error_report::ErrorReport;
1017
pub use event::Event;
1118
pub use progress_and_error_reporter::ProgressAndErrorReporter;
1219
pub use progress_report::ProgressReport;
1320

21+
use crate::size;
22+
1423
/// Report progress.
1524
pub trait Reporter<Size: size::Size> {
1625
/// Handle report event.

src/reporter/error_report.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
#![cfg_attr(
2+
dylint_lib = "perfectionist",
3+
expect(
4+
perfectionist::import_grouping_mismatch,
5+
reason = "pub use re-exports are kept in their own group; see #442"
6+
)
7+
)]
8+
19
pub mod operation;
210

311
pub use operation::Operation;
12+
413
use std::io::Error;
514
use std::path::Path;
615

src/tree_builder.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
#![cfg_attr(
2+
dylint_lib = "perfectionist",
3+
expect(
4+
perfectionist::import_grouping_mismatch,
5+
reason = "pub use re-exports are kept in their own group; see #442"
6+
)
7+
)]
8+
19
pub mod info;
210

11+
pub use info::Info;
12+
313
use super::data_tree::DataTree;
414
use super::size;
5-
pub use info::Info;
615
use rayon::prelude::*;
716

817
/// Collection of functions and starting points in order to build a [`DataTree`] with [`From`] or [`Into`].

0 commit comments

Comments
 (0)