Skip to content

Commit 57bc5b0

Browse files
authored
style: make clippy happy and remove redundant prefix (#6624)
* clippy * remove default() * style: remove redundant prefix in function.rs
1 parent c4a036d commit 57bc5b0

File tree

13 files changed

+178
-314
lines changed

13 files changed

+178
-314
lines changed

datafusion-cli/src/exec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,13 @@ mod tests {
244244

245245
async fn create_external_table_test(location: &str, sql: &str) -> Result<()> {
246246
let ctx = SessionContext::new();
247-
let plan = ctx.state().create_logical_plan(&sql).await?;
247+
let plan = ctx.state().create_logical_plan(sql).await?;
248248

249249
match &plan {
250250
LogicalPlan::Ddl(DdlStatement::CreateExternalTable(cmd)) => {
251251
create_external_table(&ctx, cmd).await?;
252252
}
253-
_ => assert!(false),
253+
_ => unreachable!(),
254254
};
255255

256256
ctx.runtime_env()

datafusion-cli/src/object_storage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub async fn get_s3_object_store_builder(
5757
.ok_or_else(|| {
5858
DataFusionError::ObjectStore(object_store::Error::Generic {
5959
store: "S3",
60-
source: format!("Failed to get S3 credentials from environment")
60+
source: "Failed to get S3 credentials from environment".to_string()
6161
.into(),
6262
})
6363
})?

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ impl ReadOptions<'_> for NdJsonReadOptions<'_> {
512512
#[async_trait]
513513
impl ReadOptions<'_> for AvroReadOptions<'_> {
514514
fn to_listing_options(&self, config: &SessionConfig) -> ListingOptions {
515-
let file_format = AvroFormat::default();
515+
let file_format = AvroFormat;
516516

517517
ListingOptions::new(Arc::new(file_format))
518518
.with_file_extension(self.file_extension)
@@ -535,7 +535,7 @@ impl ReadOptions<'_> for AvroReadOptions<'_> {
535535
#[async_trait]
536536
impl ReadOptions<'_> for ArrowReadOptions<'_> {
537537
fn to_listing_options(&self, config: &SessionConfig) -> ListingOptions {
538-
let file_format = ArrowFormat::default();
538+
let file_format = ArrowFormat;
539539

540540
ListingOptions::new(Arc::new(file_format))
541541
.with_file_extension(self.file_extension)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ impl ListingTableConfig {
133133
.map_err(|_| DataFusionError::Internal(err_msg))?;
134134

135135
let file_format: Arc<dyn FileFormat> = match file_type {
136-
FileType::ARROW => Arc::new(ArrowFormat::default()),
137-
FileType::AVRO => Arc::new(AvroFormat::default()),
136+
FileType::ARROW => Arc::new(ArrowFormat),
137+
FileType::AVRO => Arc::new(AvroFormat),
138138
FileType::CSV => Arc::new(
139139
CsvFormat::default().with_file_compression_type(file_compression_type),
140140
),

datafusion/core/src/datasource/listing_table_factory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ impl TableProviderFactory for ListingTableFactory {
7878
.with_file_compression_type(file_compression_type),
7979
),
8080
FileType::PARQUET => Arc::new(ParquetFormat::default()),
81-
FileType::AVRO => Arc::new(AvroFormat::default()),
81+
FileType::AVRO => Arc::new(AvroFormat),
8282
FileType::JSON => Arc::new(
8383
JsonFormat::default().with_file_compression_type(file_compression_type),
8484
),
85-
FileType::ARROW => Arc::new(ArrowFormat::default()),
85+
FileType::ARROW => Arc::new(ArrowFormat),
8686
};
8787

8888
let (provided_schema, table_partition_cols) = if cmd.schema.fields().is_empty() {

datafusion/core/src/physical_plan/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn create_output_batch(
209209
plan_builder.append_value(total_rows.to_string());
210210

211211
type_builder.append_value("Duration");
212-
plan_builder.append_value(format!("{:?}", duration));
212+
plan_builder.append_value(format!("{duration:?}"));
213213
}
214214

215215
RecordBatch::try_new(

datafusion/expr/src/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ impl fmt::Debug for Expr {
992992
write!(f, " FILTER (WHERE {fe})")?;
993993
}
994994
if let Some(ob) = order_by {
995-
write!(f, " ORDER BY {:?}", ob)?;
995+
write!(f, " ORDER BY {ob:?}")?;
996996
}
997997
Ok(())
998998
}
@@ -1008,7 +1008,7 @@ impl fmt::Debug for Expr {
10081008
write!(f, " FILTER (WHERE {fe})")?;
10091009
}
10101010
if let Some(ob) = order_by {
1011-
write!(f, " ORDER BY {:?}", ob)?;
1011+
write!(f, " ORDER BY {ob:?}")?;
10121012
}
10131013
Ok(())
10141014
}
@@ -1374,7 +1374,7 @@ fn create_name(e: &Expr) -> Result<String> {
13741374
info += &format!(" FILTER (WHERE {fe})");
13751375
}
13761376
if let Some(ob) = order_by {
1377-
info += &format!(" ORDER BY ({:?})", ob);
1377+
info += &format!(" ORDER BY ({ob:?})");
13781378
}
13791379
Ok(format!("{}({}){}", fun.name, names.join(","), info))
13801380
}

0 commit comments

Comments
 (0)