Skip to content

Commit

Permalink
Use Option::is_some_and where applicable
Browse files Browse the repository at this point in the history
This will become a clippy warning in the future.
  • Loading branch information
findepi committed Dec 5, 2024
1 parent 55e56c4 commit 4e292c2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
3 changes: 1 addition & 2 deletions datafusion/core/src/datasource/listing/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ impl ListingTableUrl {
Some(glob) => {
if ignore_subdirectory {
segments
.next()
.map_or(false, |file_name| glob.matches(file_name))
.next().is_some_and(|file_name| glob.matches(file_name))
} else {
let stripped = segments.join(DELIMITER);
glob.matches(&stripped)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ pub(crate) fn reorder_join_keys_to_inputs(
left.equivalence_properties(),
right.equivalence_properties(),
);
if positions.map_or(false, |idxs| !idxs.is_empty()) {
if positions.is_some_and(|idxs| !idxs.is_empty()) {
let JoinKeyPairs {
left_keys,
right_keys,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ fn plan_with_order_breaking_variants(
// not required by intermediate operators:
if maintains
&& (is_sort_preserving_merge(plan)
|| !required_ordering.map_or(false, |required_ordering| {
|| !required_ordering.is_some_and(|required_ordering| {
node.plan
.equivalence_properties()
.ordering_satisfy_requirement(&required_ordering)
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/physical_optimizer/sanity_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub fn check_finiteness_requirements(
/// [`PhysicalExpr`]: crate::physical_plan::PhysicalExpr
/// [`Operator`]: datafusion_expr::Operator
fn is_prunable(join: &SymmetricHashJoinExec) -> bool {
join.filter().map_or(false, |filter| {
join.filter().is_some_and(|filter| {
check_support(filter.expression(), &join.schema())
&& filter
.schema()
Expand Down
3 changes: 1 addition & 2 deletions datafusion/physical-expr/src/equivalence/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,7 @@ impl EquivalenceGroup {
// project. For example, if we have the mapping `(a as a1, a + c)`
// and the equivalence class `(a, b)`, expression `b` projects to `a1`.
if self
.get_equivalence_class(source)
.map_or(false, |group| group.contains(expr))
.get_equivalence_class(source).is_some_and(|group| group.contains(expr))
{
return Some(Arc::clone(target));
}
Expand Down
3 changes: 1 addition & 2 deletions datafusion/physical-plan/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ pub fn can_project(
Some(columns) => {
if columns
.iter()
.max()
.map_or(false, |&i| i >= schema.fields().len())
.max().is_some_and(|&i| i >= schema.fields().len())
{
Err(arrow_schema::ArrowError::SchemaError(format!(
"project index {} out of bounds, max field {}",
Expand Down

0 comments on commit 4e292c2

Please sign in to comment.