From c4ddacbf09802e9c4c0259abbe089a600c3ecbbc Mon Sep 17 00:00:00 2001 From: Matthijs Brobbel Date: Thu, 20 Feb 2025 19:36:21 +0100 Subject: [PATCH] Fix Clippy 1.85 warnings --- datafusion/core/tests/execution/logical_plan.rs | 6 +++--- datafusion/execution/src/runtime_env.rs | 6 ++---- datafusion/physical-expr-common/src/binary_map.rs | 2 +- datafusion/sql/src/expr/value.rs | 2 +- test-utils/src/array_gen/string.rs | 1 - 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/datafusion/core/tests/execution/logical_plan.rs b/datafusion/core/tests/execution/logical_plan.rs index a17bb5eec8a3c..b30636ddf6a81 100644 --- a/datafusion/core/tests/execution/logical_plan.rs +++ b/datafusion/core/tests/execution/logical_plan.rs @@ -15,6 +15,9 @@ // specific language governing permissions and limitations // under the License. +//! Logical plans need to provide stable semantics, as downstream projects +//! create them and depend on them. Test executable semantics of logical plans. + use arrow::array::Int64Array; use arrow::datatypes::{DataType, Field}; use datafusion::execution::session_state::SessionStateBuilder; @@ -30,9 +33,6 @@ use std::fmt::Debug; use std::ops::Deref; use std::sync::Arc; -///! Logical plans need to provide stable semantics, as downstream projects -///! create them and depend on them. Test executable semantics of logical plans. - #[tokio::test] async fn count_only_nulls() -> Result<()> { // Input: VALUES (NULL), (NULL), (NULL) AS _(col) diff --git a/datafusion/execution/src/runtime_env.rs b/datafusion/execution/src/runtime_env.rs index 2b08b7ff9e889..95f14f485792a 100644 --- a/datafusion/execution/src/runtime_env.rs +++ b/datafusion/execution/src/runtime_env.rs @@ -27,7 +27,7 @@ use crate::{ }; use crate::cache::cache_manager::{CacheManager, CacheManagerConfig}; -use datafusion_common::{DataFusionError, Result}; +use datafusion_common::Result; use object_store::ObjectStore; use std::path::PathBuf; use std::sync::Arc; @@ -150,9 +150,7 @@ impl RuntimeEnv { /// registry. See [`ObjectStoreRegistry::get_store`] for more /// details. pub fn object_store(&self, url: impl AsRef) -> Result> { - self.object_store_registry - .get_store(url.as_ref()) - .map_err(DataFusionError::from) + self.object_store_registry.get_store(url.as_ref()) } } diff --git a/datafusion/physical-expr-common/src/binary_map.rs b/datafusion/physical-expr-common/src/binary_map.rs index 809c619e9845a..b37d9a7773eeb 100644 --- a/datafusion/physical-expr-common/src/binary_map.rs +++ b/datafusion/physical-expr-common/src/binary_map.rs @@ -384,7 +384,7 @@ where // value is "small" let payload = if value.len() <= SHORT_VALUE_LEN { - let inline = value.iter().fold(0usize, |acc, &x| acc << 8 | x as usize); + let inline = value.iter().fold(0usize, |acc, &x| (acc << 8) | x as usize); // is value is already present in the set? let entry = self.map.find_mut(hash, |header| { diff --git a/datafusion/sql/src/expr/value.rs b/datafusion/sql/src/expr/value.rs index e81bfa0dc55f3..168348aee222e 100644 --- a/datafusion/sql/src/expr/value.rs +++ b/datafusion/sql/src/expr/value.rs @@ -304,7 +304,7 @@ fn try_decode_hex_literal(s: &str) -> Option> { for i in (start_idx..hex_bytes.len()).step_by(2) { let high = try_decode_hex_char(hex_bytes[i])?; let low = try_decode_hex_char(hex_bytes[i + 1])?; - decoded_bytes.push(high << 4 | low); + decoded_bytes.push((high << 4) | low); } Some(decoded_bytes) diff --git a/test-utils/src/array_gen/string.rs b/test-utils/src/array_gen/string.rs index a405cb76b1bd2..e2a983612b8b4 100644 --- a/test-utils/src/array_gen/string.rs +++ b/test-utils/src/array_gen/string.rs @@ -97,7 +97,6 @@ fn random_string(rng: &mut StdRng, max_len: usize) -> String { let len = rng.gen_range(1..=max_len); rng.sample_iter::(rand::distributions::Standard) .take(len) - .map(char::from) .collect::() } }