Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
review: use expect + move existing rule from lib.rs -> clippytoml
  • Loading branch information
2010YOUY01 committed Nov 6, 2025
commit dac10047c91d64cdc101230774ee6ccc498bf214
3 changes: 3 additions & 0 deletions datafusion/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ all-features = true
# moves.
# Reference: <https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value>
needless_pass_by_value = "deny"
# Make sure fast / cheap clones on Arc are explicit:
# https://github.com/apache/datafusion/issues/11143
clone_on_ref_ptr = "deny"

[lib]
name = "datafusion_common"
Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ mod tests {
use arrow::datatypes::{DataType, SchemaBuilder};
use std::sync::Arc;

#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
fn create_qualified_schema(qualifier: &str, names: Vec<&str>) -> Result<DFSchema> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could change this to impl IntoIterator<Item = &str> for example

Suggested change
fn create_qualified_schema(qualifier: &str, names: Vec<&str>) -> Result<DFSchema> {
fn create_qualified_schema(qualifier: &str, names: impl IntoIterator<Item = &str>) -> Result<DFSchema> {

let mut schema_builder = SchemaBuilder::new();
schema_builder.extend(
Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ mod test {
Err(ArrowError::SchemaError("bar".to_string()).into())
}

#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
fn do_root_test(e: DataFusionError, exp: DataFusionError) {
let e = e.find_root();

Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/file_options/parquet_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ mod tests {
}
}

#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
fn extract_column_options(
props: &WriterProperties,
col: ColumnPath,
Expand Down
3 changes: 0 additions & 3 deletions datafusion/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
html_favicon_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg"
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
// Make sure fast / cheap clones on Arc are explicit:
// https://github.com/apache/datafusion/issues/11143
#![deny(clippy::clone_on_ref_ptr)]

mod column;
mod dfschema;
Expand Down
6 changes: 3 additions & 3 deletions datafusion/common/src/scalar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5567,7 +5567,7 @@ mod tests {
}

// Verifies that ScalarValue has the same behavior with compute kernel when it overflows.
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
fn check_scalar_add_overflow<T>(left: ScalarValue, right: ScalarValue)
where
T: ArrowNumericType,
Expand Down Expand Up @@ -7097,7 +7097,7 @@ mod tests {
/// 1. convert to a `ScalarValue`
/// 2. Convert `ScalarValue` back to an `ArrayRef`
/// 3. Compare the original array (sliced) and new array for equality
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
fn round_trip_through_scalar(arr: ArrayRef) {
for i in 0..arr.len() {
// convert Scalar --> Array
Expand Down Expand Up @@ -7570,7 +7570,7 @@ mod tests {
}

// mimics how casting work on scalar values by `casting` `scalar` to `desired_type`
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
fn check_scalar_cast(scalar: ScalarValue, desired_type: DataType) {
// convert from scalar --> Array to call cast
let scalar_array = scalar.to_array().expect("Failed to convert to array");
Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/src/scalar/struct_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl ScalarStructBuilder {
}

/// Add the specified field and `ScalarValue` to the struct.
#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
pub fn with_scalar(self, field: impl IntoFieldRef, value: ScalarValue) -> Self {
// valid scalar value should not fail
let array = value.to_array().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ impl LogicalPlan {

/// Helper for [Self::with_new_exprs] to use when no expressions are expected.
#[inline]
#[allow(clippy::needless_pass_by_value)] // expr is moved intentionally to ensure it's not used again
#[expect(clippy::needless_pass_by_value)] // expr is moved intentionally to ensure it's not used again
fn assert_no_expressions(&self, expr: Vec<Expr>) -> Result<()> {
if !expr.is_empty() {
return internal_err!("{self:?} should have no exprs, got {:?}", expr);
Expand All @@ -1166,7 +1166,7 @@ impl LogicalPlan {

/// Helper for [Self::with_new_exprs] to use when no inputs are expected.
#[inline]
#[allow(clippy::needless_pass_by_value)] // inputs is moved intentionally to ensure it's not used again
#[expect(clippy::needless_pass_by_value)] // inputs is moved intentionally to ensure it's not used again
fn assert_no_inputs(&self, inputs: Vec<LogicalPlan>) -> Result<()> {
if !inputs.is_empty() {
return internal_err!("{self:?} should have no inputs, got: {:?}", inputs);
Expand Down