Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new clippy lints #4734

Merged
merged 4 commits into from
Aug 24, 2023
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
Next Next commit
Fix new clippy lints
  • Loading branch information
tustvold committed Aug 24, 2023
commit 2e7d11be95cd52429e651d3a03df51dcc4cdada2
5 changes: 1 addition & 4 deletions arrow-array/src/array/dictionary_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,7 @@ pub struct TypedDictionaryArray<'a, K: ArrowDictionaryKeyType, V> {
// Manually implement `Clone` to avoid `V: Clone` type constraint
impl<'a, K: ArrowDictionaryKeyType, V> Clone for TypedDictionaryArray<'a, K, V> {
fn clone(&self) -> Self {
Self {
dictionary: self.dictionary,
values: self.values,
}
*self
}
}

Expand Down
5 changes: 1 addition & 4 deletions arrow-array/src/array/run_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,7 @@ pub struct TypedRunArray<'a, R: RunEndIndexType, V> {
// Manually implement `Clone` to avoid `V: Clone` type constraint
impl<'a, R: RunEndIndexType, V> Clone for TypedRunArray<'a, R, V> {
fn clone(&self) -> Self {
Self {
run_array: self.run_array,
values: self.values,
}
*self
}
}

Expand Down
2 changes: 1 addition & 1 deletion arrow-buffer/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ pub trait ToByteSlice {
impl<T: ArrowNativeType> ToByteSlice for [T] {
#[inline]
fn to_byte_slice(&self) -> &[u8] {
let raw_ptr = self.as_ptr() as *const T as *const u8;
let raw_ptr = self.as_ptr() as *const u8;
unsafe { std::slice::from_raw_parts(raw_ptr, std::mem::size_of_val(self)) }
}
}
Expand Down
2 changes: 1 addition & 1 deletion arrow-buffer/src/util/bit_chunk_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<'a> UnalignedBitChunk<'a> {
self.prefix
.into_iter()
.chain(self.chunks.iter().cloned())
.chain(self.suffix.into_iter())
.chain(self.suffix)
}

/// Counts the number of ones
Expand Down
14 changes: 5 additions & 9 deletions arrow-cast/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,15 +1003,11 @@ impl Interval {
fn parse(value: &str, config: &IntervalParseConfig) -> Result<Self, ArrowError> {
let components = parse_interval_components(value, config)?;

let result = components.into_iter().fold(
Ok(Self::default()),
|result, (amount, unit)| match result {
Ok(result) => result.add(amount, unit),
Err(e) => Err(e),
},
)?;

Ok(result)
components
.into_iter()
.try_fold(Self::default(), |result, (amount, unit)| {
result.add(amount, unit)
})
}

/// Interval addition following Postgres behavior. Fractional units will be spilled into smaller units.
Expand Down
2 changes: 1 addition & 1 deletion arrow-ipc/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ pub(crate) fn get_fb_field_type<'a>(
RunEndEncoded(run_ends, values) => {
let run_ends_field = build_field(fbb, run_ends);
let values_field = build_field(fbb, values);
let children = vec![run_ends_field, values_field];
let children = [run_ends_field, values_field];
FBFieldType {
type_type: crate::Type::RunEndEncoded,
type_: crate::RunEndEncodedBuilder::new(fbb)
Expand Down
10 changes: 4 additions & 6 deletions arrow-json/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,9 @@ fn set_column_for_json_rows(
}
DataType::Struct(_) => {
let inner_objs = struct_array_to_jsonmap_array(array.as_struct())?;
rows.iter_mut()
.zip(inner_objs.into_iter())
.for_each(|(row, obj)| {
row.insert(col_name.to_string(), Value::Object(obj));
});
rows.iter_mut().zip(inner_objs).for_each(|(row, obj)| {
row.insert(col_name.to_string(), Value::Object(obj));
});
}
DataType::List(_) => {
let listarr = as_list_array(array);
Expand Down Expand Up @@ -374,7 +372,7 @@ fn set_column_for_json_rows(
let keys = keys.as_string::<i32>();
let values = array_to_json_array(values)?;

let mut kv = keys.iter().zip(values.into_iter());
let mut kv = keys.iter().zip(values);

for (i, row) in rows.iter_mut().enumerate() {
if maparr.is_null(i) {
Expand Down
1 change: 1 addition & 0 deletions arrow-string/src/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// under the License.

//! Defines kernel for length of string arrays and binary arrays
#![allow(clippy::redundant_closure_call)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is fixed properly by #4718


use arrow_array::*;
use arrow_array::{cast::AsArray, types::*};
Expand Down
6 changes: 3 additions & 3 deletions arrow/tests/array_equal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ fn test_empty_offsets_list_equal() {
true,
))))
.len(0)
.add_buffer(Buffer::from(vec![0i32, 2, 3, 4, 6, 7, 8].to_byte_slice()))
.add_buffer(Buffer::from([0i32, 2, 3, 4, 6, 7, 8].to_byte_slice()))
.add_child_data(Int32Array::from(vec![1, 2, -1, -2, 3, 4, -3, -4]).into_data())
.null_bit_buffer(Some(Buffer::from(vec![0b00001001])))
.build()
Expand Down Expand Up @@ -437,7 +437,7 @@ fn test_list_null() {
true,
))))
.len(6)
.add_buffer(Buffer::from(vec![0i32, 2, 3, 4, 6, 7, 8].to_byte_slice()))
.add_buffer(Buffer::from([0i32, 2, 3, 4, 6, 7, 8].to_byte_slice()))
.add_child_data(c_values.into_data())
.null_bit_buffer(Some(Buffer::from(vec![0b00001001])))
.build()
Expand All @@ -460,7 +460,7 @@ fn test_list_null() {
true,
))))
.len(6)
.add_buffer(Buffer::from(vec![0i32, 2, 3, 4, 6, 7, 8].to_byte_slice()))
.add_buffer(Buffer::from([0i32, 2, 3, 4, 6, 7, 8].to_byte_slice()))
.add_child_data(d_values.into_data())
.null_bit_buffer(Some(Buffer::from(vec![0b00001001])))
.build()
Expand Down