From ba094e72924147d4afdd6547aba5e14717ebc58c Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Wed, 6 Nov 2024 20:52:25 -0500 Subject: [PATCH] Minor: Clarify use of infallable APIs (#13217) --- datafusion/expr/src/expr.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/datafusion/expr/src/expr.rs b/datafusion/expr/src/expr.rs index 025a48731d48..0cdfa055216b 100644 --- a/datafusion/expr/src/expr.rs +++ b/datafusion/expr/src/expr.rs @@ -1563,13 +1563,13 @@ impl Expr { /// Returns true if there are any column references in this Expr pub fn any_column_refs(&self) -> bool { self.exists(|expr| Ok(matches!(expr, Expr::Column(_)))) - .unwrap() + .expect("exists closure is infallible") } - /// Return true when the expression contains out reference(correlated) expressions. + /// Return true if the expression contains out reference(correlated) expressions. pub fn contains_outer(&self) -> bool { self.exists(|expr| Ok(matches!(expr, Expr::OuterReferenceColumn { .. }))) - .unwrap() + .expect("exists closure is infallible") } /// Returns true if the expression node is volatile, i.e. whether it can return @@ -1589,7 +1589,8 @@ impl Expr { /// /// See [`Volatility`] for more information. pub fn is_volatile(&self) -> bool { - self.exists(|expr| Ok(expr.is_volatile_node())).unwrap() + self.exists(|expr| Ok(expr.is_volatile_node())) + .expect("exists closure is infallible") } /// Recursively find all [`Expr::Placeholder`] expressions, and