Skip to content

Commit cecf231

Browse files
committed
Apply clippy fixes
`dev/rust_lint.sh` no longer passes for me, maybe because of `rustup update`. This is first portion of fixes suggested by clippy.
1 parent 5818732 commit cecf231

File tree

56 files changed

+78
-78
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+78
-78
lines changed

datafusion/common/src/column.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl Column {
110110
pub fn from_qualified_name(flat_name: impl Into<String>) -> Self {
111111
let flat_name = flat_name.into();
112112
Self::from_idents(&mut parse_identifiers_normalized(&flat_name, false))
113-
.unwrap_or_else(|| Self {
113+
.unwrap_or(Self {
114114
relation: None,
115115
name: flat_name,
116116
})
@@ -120,7 +120,7 @@ impl Column {
120120
pub fn from_qualified_name_ignore_case(flat_name: impl Into<String>) -> Self {
121121
let flat_name = flat_name.into();
122122
Self::from_idents(&mut parse_identifiers_normalized(&flat_name, true))
123-
.unwrap_or_else(|| Self {
123+
.unwrap_or(Self {
124124
relation: None,
125125
name: flat_name,
126126
})

datafusion/common/src/hash_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub trait HashValue {
6363
fn hash_one(&self, state: &RandomState) -> u64;
6464
}
6565

66-
impl<'a, T: HashValue + ?Sized> HashValue for &'a T {
66+
impl<T: HashValue + ?Sized> HashValue for &T {
6767
fn hash_one(&self, state: &RandomState) -> u64 {
6868
T::hash_one(self, state)
6969
}

datafusion/common/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ pub mod datafusion_strsim {
569569

570570
struct StringWrapper<'a>(&'a str);
571571

572-
impl<'a, 'b> IntoIterator for &'a StringWrapper<'b> {
572+
impl<'b> IntoIterator for &StringWrapper<'b> {
573573
type Item = char;
574574
type IntoIter = Chars<'b>;
575575

datafusion/core/src/datasource/avro_to_arrow/arrow_array_reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub struct AvroArrowArrayReader<'a, R: Read> {
6060
schema_lookup: BTreeMap<String, usize>,
6161
}
6262

63-
impl<'a, R: Read> AvroArrowArrayReader<'a, R> {
63+
impl<R: Read> AvroArrowArrayReader<'_, R> {
6464
pub fn try_new(
6565
reader: R,
6666
schema: SchemaRef,

datafusion/core/src/datasource/avro_to_arrow/reader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub struct Reader<'a, R: Read> {
128128
batch_size: usize,
129129
}
130130

131-
impl<'a, R: Read> Reader<'a, R> {
131+
impl<R: Read> Reader<'_, R> {
132132
/// Create a new Avro Reader from any value that implements the `Read` trait.
133133
///
134134
/// If reading a `File`, you can customise the Reader, such as to enable schema
@@ -157,7 +157,7 @@ impl<'a, R: Read> Reader<'a, R> {
157157
}
158158
}
159159

160-
impl<'a, R: Read> Iterator for Reader<'a, R> {
160+
impl<R: Read> Iterator for Reader<'_, R> {
161161
type Item = ArrowResult<RecordBatch>;
162162

163163
/// Returns the next batch of results (defined by `self.batch_size`), or `None` if there

datafusion/core/src/datasource/file_format/options.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub struct CsvReadOptions<'a> {
8989
pub file_sort_order: Vec<Vec<SortExpr>>,
9090
}
9191

92-
impl<'a> Default for CsvReadOptions<'a> {
92+
impl Default for CsvReadOptions<'_> {
9393
fn default() -> Self {
9494
Self::new()
9595
}
@@ -243,7 +243,7 @@ pub struct ParquetReadOptions<'a> {
243243
pub file_sort_order: Vec<Vec<SortExpr>>,
244244
}
245245

246-
impl<'a> Default for ParquetReadOptions<'a> {
246+
impl Default for ParquetReadOptions<'_> {
247247
fn default() -> Self {
248248
Self {
249249
file_extension: DEFAULT_PARQUET_EXTENSION,
@@ -323,7 +323,7 @@ pub struct ArrowReadOptions<'a> {
323323
pub table_partition_cols: Vec<(String, DataType)>,
324324
}
325325

326-
impl<'a> Default for ArrowReadOptions<'a> {
326+
impl Default for ArrowReadOptions<'_> {
327327
fn default() -> Self {
328328
Self {
329329
schema: None,
@@ -368,7 +368,7 @@ pub struct AvroReadOptions<'a> {
368368
pub table_partition_cols: Vec<(String, DataType)>,
369369
}
370370

371-
impl<'a> Default for AvroReadOptions<'a> {
371+
impl Default for AvroReadOptions<'_> {
372372
fn default() -> Self {
373373
Self {
374374
schema: None,
@@ -420,7 +420,7 @@ pub struct NdJsonReadOptions<'a> {
420420
pub file_sort_order: Vec<Vec<SortExpr>>,
421421
}
422422

423-
impl<'a> Default for NdJsonReadOptions<'a> {
423+
impl Default for NdJsonReadOptions<'_> {
424424
fn default() -> Self {
425425
Self {
426426
schema: None,

datafusion/core/src/datasource/file_format/parquet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ impl<'a> ObjectStoreFetch<'a> {
477477
}
478478
}
479479

480-
impl<'a> MetadataFetch for ObjectStoreFetch<'a> {
480+
impl MetadataFetch for ObjectStoreFetch<'_> {
481481
fn fetch(
482482
&mut self,
483483
range: Range<usize>,

datafusion/core/src/datasource/listing/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub fn split_files(
135135
partitioned_files.sort_by(|a, b| a.path().cmp(b.path()));
136136

137137
// effectively this is div with rounding up instead of truncating
138-
let chunk_size = (partitioned_files.len() + n - 1) / n;
138+
let chunk_size = partitioned_files.len().div_ceil(n);
139139
let mut chunks = Vec::with_capacity(n);
140140
let mut current_chunk = Vec::with_capacity(chunk_size);
141141
for file in partitioned_files.drain(..) {

datafusion/core/src/datasource/physical_plan/file_groups.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl FileGroupPartitioner {
218218
}
219219

220220
let target_partition_size =
221-
(total_size as usize + (target_partitions) - 1) / (target_partitions);
221+
(total_size as usize).div_ceil(target_partitions);
222222

223223
let current_partition_index: usize = 0;
224224
let current_partition_size: usize = 0;

datafusion/core/src/datasource/physical_plan/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl DisplayAs for FileScanConfig {
139139
#[derive(Debug)]
140140
struct FileGroupsDisplay<'a>(&'a [Vec<PartitionedFile>]);
141141

142-
impl<'a> DisplayAs for FileGroupsDisplay<'a> {
142+
impl DisplayAs for FileGroupsDisplay<'_> {
143143
fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult {
144144
let n_groups = self.0.len();
145145
let groups = if n_groups == 1 { "group" } else { "groups" };
@@ -171,7 +171,7 @@ impl<'a> DisplayAs for FileGroupsDisplay<'a> {
171171
#[derive(Debug)]
172172
pub(crate) struct FileGroupDisplay<'a>(pub &'a [PartitionedFile]);
173173

174-
impl<'a> DisplayAs for FileGroupDisplay<'a> {
174+
impl DisplayAs for FileGroupDisplay<'_> {
175175
fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult {
176176
write!(f, "[")?;
177177
match t {

0 commit comments

Comments
 (0)