Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions dylint.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
[workspace.metadata.dylint]
libraries = [
{ git = "https://github.com/KSXGitHub/perfectionist", tag = "0.0.0-rc.14" },
]

[perfectionist]
disable = [
{ name = "arc_rc_clone", reason = "already use clippy::clone_on_ref_ptr" },
{ git = "https://github.com/KSXGitHub/perfectionist", tag = "0.0.0-rc.17" },
]

["perfectionist::derive_ordering"]
Expand All @@ -24,6 +19,11 @@ prefix = [
"LowerHex", "UpperHex", "Octal",
]

# The intended long-term style is "module". It is set to "crate" for now.
# See https://github.com/KSXGitHub/parallel-disk-usage/issues/432.
["perfectionist::import_granularity"]
style = "crate"

["perfectionist::macro_argument_binding"]
deny_extra = ["debug_assert_op", "debug_assert_op_expr"]
allow_extra = ["assert_op_expr"]
Expand Down
28 changes: 14 additions & 14 deletions src/hardlink/hardlink_list/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn add<const ROW: usize>(list: HardlinkList<Bytes>) -> HardlinkList<Bytes> {

#[test]
fn insertion_order_is_irrelevant_to_equality() {
let a = HardlinkList::new()
let first_order = HardlinkList::new()
.pipe(add::<3>)
.pipe(add::<1>)
.pipe(add::<4>)
Expand All @@ -37,7 +37,7 @@ fn insertion_order_is_irrelevant_to_equality() {
.pipe(add::<2>)
.into_reflection();

let b = HardlinkList::new()
let second_order = HardlinkList::new()
.pipe(add::<5>)
.pipe(add::<6>)
.pipe(add::<2>)
Expand All @@ -48,7 +48,7 @@ fn insertion_order_is_irrelevant_to_equality() {
.pipe(add::<4>)
.into_reflection();

let c = HardlinkList::new()
let sorted_order = HardlinkList::new()
.pipe(add::<0>)
.pipe(add::<1>)
.pipe(add::<2>)
Expand All @@ -59,14 +59,14 @@ fn insertion_order_is_irrelevant_to_equality() {
.pipe(add::<7>)
.into_reflection();

assert_eq!(a, b);
assert_eq!(b, c);
assert_eq!(a, c);
assert_eq!(first_order, second_order);
assert_eq!(second_order, sorted_order);
assert_eq!(first_order, sorted_order);
}

#[test]
fn omitting_insertion_cause_inequality() {
let a = HardlinkList::new()
let complete = HardlinkList::new()
.pipe(add::<0>)
.pipe(add::<1>)
.pipe(add::<2>)
Expand All @@ -77,7 +77,7 @@ fn omitting_insertion_cause_inequality() {
.pipe(add::<7>)
.into_reflection();

let b = HardlinkList::new()
let missing_one = HardlinkList::new()
.pipe(add::<0>)
.pipe(add::<1>)
.pipe(add::<2>)
Expand All @@ -87,13 +87,13 @@ fn omitting_insertion_cause_inequality() {
.pipe(add::<7>)
.into_reflection();

assert_ne!(a, b);
assert_ne!(b, a);
assert_ne!(complete, missing_one);
assert_ne!(missing_one, complete);
}

#[test]
fn insertion_difference_cause_inequality() {
let a = HardlinkList::new()
let with_row_6 = HardlinkList::new()
.pipe(add::<0>)
.pipe(add::<1>)
.pipe(add::<2>)
Expand All @@ -103,7 +103,7 @@ fn insertion_difference_cause_inequality() {
.pipe(add::<6>)
.into_reflection();

let b = HardlinkList::new()
let with_row_7 = HardlinkList::new()
.pipe(add::<0>)
.pipe(add::<1>)
.pipe(add::<2>)
Expand All @@ -113,8 +113,8 @@ fn insertion_difference_cause_inequality() {
.pipe(add::<7>)
.into_reflection();

assert_ne!(a, b);
assert_ne!(b, a);
assert_ne!(with_row_6, with_row_7);
assert_ne!(with_row_7, with_row_6);
}

#[test]
Expand Down
28 changes: 14 additions & 14 deletions src/hardlink/link_path_list/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,40 @@ use pretty_assertions::{assert_eq, assert_ne};

#[test]
fn item_order_is_irrelevant_to_equality() {
let a = ["3", "4", "0", "2", "1"]
let first_order = ["3", "4", "0", "2", "1"]
.pipe(LinkPathList::many)
.into_reflection();
let b = ["4", "0", "3", "2", "1"]
let second_order = ["4", "0", "3", "2", "1"]
.pipe(LinkPathList::many)
.into_reflection();
let c = ["0", "1", "2", "3", "4"]
let sorted_order = ["0", "1", "2", "3", "4"]
.pipe(LinkPathList::many)
.into_reflection();
assert_eq!(a, b);
assert_eq!(b, c);
assert_eq!(a, c);
assert_eq!(first_order, second_order);
assert_eq!(second_order, sorted_order);
assert_eq!(first_order, sorted_order);
}

#[test]
fn item_absent_cause_inequality() {
let a = ["0", "1", "2", "3"]
let without_last = ["0", "1", "2", "3"]
.pipe(LinkPathList::many)
.into_reflection();
let b = ["0", "1", "2", "3", "4"]
let with_last = ["0", "1", "2", "3", "4"]
.pipe(LinkPathList::many)
.into_reflection();
assert_ne!(a, b);
assert_ne!(b, a);
assert_ne!(without_last, with_last);
assert_ne!(with_last, without_last);
}

#[test]
fn item_difference_cause_inequality() {
let a = ["0", "1", "2", "3", "5"]
let with_five = ["0", "1", "2", "3", "5"]
.pipe(LinkPathList::many)
.into_reflection();
let b = ["0", "1", "2", "3", "4"]
let with_four = ["0", "1", "2", "3", "4"]
.pipe(LinkPathList::many)
.into_reflection();
assert_ne!(a, b);
assert_ne!(b, a);
assert_ne!(with_five, with_four);
assert_ne!(with_four, with_five);
}
3 changes: 1 addition & 2 deletions src/usage_md.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::args::Args;
use clap::builder::PossibleValue;
use clap::{Arg, ArgAction, Command, CommandFactory};
use clap::{Arg, ArgAction, Command, CommandFactory, builder::PossibleValue};
use derive_more::{Display, Error};
use itertools::Itertools;
use pipe_trait::Pipe;
Expand Down
2 changes: 1 addition & 1 deletion tests/_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub const DEFAULT_GET_SIZE: get_size::GetApparentSize = get_size::GetApparentSiz

/// Representation of a temporary filesystem item.
///
/// **NOTE:** Delete this once https://github.com/samgiles/rs-mktemp/issues/8 is resolved.
/// **NOTE:** Delete this once <https://github.com/samgiles/rs-mktemp/issues/8> is resolved.
#[derive(Debug, AsRef, Deref)]
#[as_ref(forward)]
#[deref(forward)]
Expand Down
15 changes: 12 additions & 3 deletions tests/args_fraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ use parallel_disk_usage::args::fraction::{ConversionError::*, Fraction, FromStrE
use pretty_assertions::assert_eq;

#[test]
#[allow(clippy::float_cmp)]
#[allow(
clippy::float_cmp,
reason = "the parsed fraction is expected to equal the source literal exactly"
)]
fn typical() {
let actual: f32 = "0.5".parse::<Fraction>().expect("create ratio").into();
assert_eq!(actual, 0.5);
}

#[test]
#[allow(clippy::float_cmp)]
#[allow(
clippy::float_cmp,
reason = "the parsed fraction is expected to equal the source literal exactly"
)]
fn equal_to_zero() {
let actual: f32 = "0".parse::<Fraction>().expect("create ratio").into();
assert_eq!(actual, 0.0);
Expand All @@ -30,7 +36,10 @@ fn less_than_zero() {
}

#[test]
#[allow(clippy::float_cmp)]
#[allow(
clippy::float_cmp,
reason = "the parsed fraction is expected to equal the source literal exactly"
)]
fn less_than_one() {
let actual: f32 = "0.99999".parse::<Fraction>().expect("create ratio").into();
assert_eq!(actual, 0.99999);
Expand Down
15 changes: 12 additions & 3 deletions tests/hardlinks_deduplication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ fn stdio(command: Command) -> Command {

#[test]
fn simple_tree_with_some_hardlinks() {
#![expect(clippy::identity_op)]
#![expect(
clippy::identity_op,
reason = "the explicit identity terms keep each component aligned with the structure it represents"
)]

let sizes = [200_000, 220_000, 310_000, 110_000, 210_000];
let workspace = SampleWorkspace::simple_tree_with_some_hardlinks(sizes);
Expand Down Expand Up @@ -488,7 +491,10 @@ fn complex_tree_with_shared_and_unique_files() {
// of reasoning.
// It should still produce the same result as the proper
// deduplication formula however.
#[expect(clippy::erasing_op)]
#[expect(
clippy::erasing_op,
reason = "the explicit zero term keeps the external branch aligned with its siblings in the size breakdown"
)]
let expected_size: Bytes = [
inode_size("."),
inode_size("no-hardlinks"),
Expand Down Expand Up @@ -665,7 +671,10 @@ fn complex_tree_with_shared_and_unique_files() {

#[test]
fn hardlinks_and_non_hardlinks() {
#![expect(clippy::identity_op)]
#![expect(
clippy::identity_op,
reason = "the explicit identity terms keep each component aligned with the structure it represents"
)]

let files_per_branch = 2 * 4;
let workspace =
Expand Down
10 changes: 8 additions & 2 deletions tests/hardlinks_deduplication_multi_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ fn stdio(command: Command) -> Command {

#[test]
fn simple_tree_with_some_hardlinks() {
#![expect(clippy::identity_op)]
#![expect(
clippy::identity_op,
reason = "the explicit identity terms keep each component aligned with the structure it represents"
)]

let sizes = [200_000, 220_000, 310_000, 110_000, 210_000];
let workspace = SampleWorkspace::simple_tree_with_some_hardlinks(sizes);
Expand Down Expand Up @@ -397,7 +400,10 @@ fn multiple_hardlinks_to_a_single_file() {

#[test]
fn multiple_duplicated_arguments() {
#![expect(clippy::identity_op)]
#![expect(
clippy::identity_op,
reason = "the explicit identity terms keep each component aligned with the structure it represents"
)]

let sizes = [200_000, 220_000, 310_000, 110_000, 210_000];
let workspace = SampleWorkspace::simple_tree_with_some_symlinks_and_hardlinks(sizes);
Expand Down
Loading