Skip to content

Commit

Permalink
find: fix usage of legacy numeric methods (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
cakebaker authored Jun 14, 2024
1 parent 9502a7c commit d35aebf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
50 changes: 25 additions & 25 deletions src/find/matchers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,15 +1062,15 @@ mod tests {
"0 should not be less than 0"
);
assert!(
ComparableValue::LessThan(u64::max_value()).matches(0),
ComparableValue::LessThan(u64::MAX).matches(0),
"0 should be less than max_value"
);
assert!(
!ComparableValue::LessThan(0).matches(u64::max_value()),
!ComparableValue::LessThan(0).matches(u64::MAX),
"max_value should not be less than 0"
);
assert!(
!ComparableValue::LessThan(u64::max_value()).matches(u64::max_value()),
!ComparableValue::LessThan(u64::MAX).matches(u64::MAX),
"max_value should not be less than max_value"
);

Expand All @@ -1079,15 +1079,15 @@ mod tests {
"0 should be equal to 0"
);
assert!(
!ComparableValue::EqualTo(u64::max_value()).matches(0),
!ComparableValue::EqualTo(u64::MAX).matches(0),
"0 should not be equal to max_value"
);
assert!(
!ComparableValue::EqualTo(0).matches(u64::max_value()),
!ComparableValue::EqualTo(0).matches(u64::MAX),
"max_value should not be equal to 0"
);
assert!(
ComparableValue::EqualTo(u64::max_value()).matches(u64::max_value()),
ComparableValue::EqualTo(u64::MAX).matches(u64::MAX),
"max_value should be equal to max_value"
);

Expand All @@ -1096,15 +1096,15 @@ mod tests {
"0 should not be more than 0"
);
assert!(
!ComparableValue::MoreThan(u64::max_value()).matches(0),
!ComparableValue::MoreThan(u64::MAX).matches(0),
"0 should not be more than max_value"
);
assert!(
ComparableValue::MoreThan(0).matches(u64::max_value()),
ComparableValue::MoreThan(0).matches(u64::MAX),
"max_value should be more than 0"
);
assert!(
!ComparableValue::MoreThan(u64::max_value()).matches(u64::max_value()),
!ComparableValue::MoreThan(u64::MAX).matches(u64::MAX),
"max_value should not be more than max_value"
);
}
Expand All @@ -1116,23 +1116,23 @@ mod tests {
"0 should not be less than 0"
);
assert!(
ComparableValue::LessThan(u64::max_value()).imatches(0),
ComparableValue::LessThan(u64::MAX).imatches(0),
"0 should be less than max_value"
);
assert!(
!ComparableValue::LessThan(0).imatches(i64::max_value()),
!ComparableValue::LessThan(0).imatches(i64::MAX),
"max_value should not be less than 0"
);
assert!(
ComparableValue::LessThan(u64::max_value()).imatches(i64::max_value()),
ComparableValue::LessThan(u64::MAX).imatches(i64::MAX),
"max_value should be less than max_value"
);
assert!(
ComparableValue::LessThan(0).imatches(i64::min_value()),
ComparableValue::LessThan(0).imatches(i64::MIN),
"min_value should be less than 0"
);
assert!(
ComparableValue::LessThan(u64::max_value()).imatches(i64::min_value()),
ComparableValue::LessThan(u64::MAX).imatches(i64::MIN),
"min_value should be less than max_value"
);

Expand All @@ -1141,27 +1141,27 @@ mod tests {
"0 should be equal to 0"
);
assert!(
!ComparableValue::EqualTo(u64::max_value()).imatches(0),
!ComparableValue::EqualTo(u64::MAX).imatches(0),
"0 should not be equal to max_value"
);
assert!(
!ComparableValue::EqualTo(0).imatches(i64::max_value()),
!ComparableValue::EqualTo(0).imatches(i64::MAX),
"max_value should not be equal to 0"
);
assert!(
!ComparableValue::EqualTo(u64::max_value()).imatches(i64::max_value()),
!ComparableValue::EqualTo(u64::MAX).imatches(i64::MAX),
"max_value should not be equal to i64::max_value"
);
assert!(
ComparableValue::EqualTo(i64::max_value() as u64).imatches(i64::max_value()),
ComparableValue::EqualTo(i64::MAX as u64).imatches(i64::MAX),
"i64::max_value should be equal to i64::max_value"
);
assert!(
!ComparableValue::EqualTo(0).imatches(i64::min_value()),
!ComparableValue::EqualTo(0).imatches(i64::MIN),
"min_value should not be equal to 0"
);
assert!(
!ComparableValue::EqualTo(u64::max_value()).imatches(i64::min_value()),
!ComparableValue::EqualTo(u64::MAX).imatches(i64::MIN),
"min_value should not be equal to max_value"
);

Expand All @@ -1170,23 +1170,23 @@ mod tests {
"0 should not be more than 0"
);
assert!(
!ComparableValue::MoreThan(u64::max_value()).imatches(0),
!ComparableValue::MoreThan(u64::MAX).imatches(0),
"0 should not be more than max_value"
);
assert!(
ComparableValue::MoreThan(0).imatches(i64::max_value()),
ComparableValue::MoreThan(0).imatches(i64::MAX),
"max_value should be more than 0"
);
assert!(
!ComparableValue::MoreThan(u64::max_value()).imatches(i64::max_value()),
!ComparableValue::MoreThan(u64::MAX).imatches(i64::MAX),
"max_value should not be more than max_value"
);
assert!(
!ComparableValue::MoreThan(0).imatches(i64::min_value()),
!ComparableValue::MoreThan(0).imatches(i64::MIN),
"min_value should not be more than 0"
);
assert!(
!ComparableValue::MoreThan(u64::max_value()).imatches(i64::min_value()),
!ComparableValue::MoreThan(u64::MAX).imatches(i64::MIN),
"min_value should not be more than max_value"
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/find/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Default for Config {
same_file_system: false,
depth_first: false,
min_depth: 0,
max_depth: usize::max_value(),
max_depth: usize::MAX,
sorted_output: false,
help_requested: false,
version_requested: false,
Expand Down

0 comments on commit d35aebf

Please sign in to comment.