emilk commented on code in PR #24322:
URL: https://github.com/apache/datafusion/pull/24322#discussion_r3774961480
##########
datafusion/core/tests/user_defined/user_defined_scalar_functions.rs:
##########
@@ -1877,7 +1872,7 @@ impl ExtensionType for MyUserExtensionType {
&self,
data_type: &DataType,
) -> std::result::Result<(), ArrowError> {
- if let DataType::Utf8 = data_type {
+ if matches!(data_type, DataType::Utf8) {
Review Comment:
could this be `==`?
##########
datafusion/spark/src/function/string/length.rs:
##########
@@ -154,10 +154,10 @@ where
} else {
let values: Vec<_> = (0..array.len())
.map(|i| {
- // Safety: we are iterating with array.len() so the index
is always valid
if array.is_null(i) {
i32::default()
} else {
+ // SAFETY: we are iterating with array.len() so the
index is always valid
Review Comment:
let's revert the commit+lint that changed all these safety comments
##########
datafusion/pruning/src/pruning_predicate.rs:
##########
@@ -795,14 +795,12 @@ impl BoolVecBuilder {
fn is_always_true(expr: &Arc<dyn PhysicalExpr>) -> bool {
expr.downcast_ref::<phys_expr::Literal>()
- .map(|l| matches!(l.value(), ScalarValue::Boolean(Some(true))))
- .unwrap_or_default()
+ .is_some_and(|l| matches!(l.value(), ScalarValue::Boolean(Some(true))))
Review Comment:
could this use `==` ?
##########
datafusion/expr/src/predicate_bounds.rs:
##########
@@ -166,7 +166,7 @@ impl PredicateBoundsEvaluator<'_> {
}
// If `expr` is not nullable, we can be certain `expr` is not null
- if let Ok(false) = expr.nullable(self.input_schema) {
+ if matches!(expr.nullable(self.input_schema), Ok(false)) {
Review Comment:
can use ==
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]