Skip to content

Commit 415bd42

Browse files
authored
chore: Remove duplicate imports in test code (#21061)
## Which issue does this PR close? N/A ## Rationale for this change `clippy` doesn't warn about `use` statements that re-import an item that is already available via a glob import (`use super::*`), but in many cases the `use` statement is redundant and can be safely removed. In particular, there was a lot of test code that did both `use super::*` and also imported items that were imported by the module under test; the test-specific import can be safely removed. ## What changes are included in this PR? * Mechanical removal of duplicate imports between test code and code under test ## Are these changes tested? Yes, via `cargo check` and `cargo clippy` ## Are there any user-facing changes? No.
1 parent d6cffd7 commit 415bd42

121 files changed

Lines changed: 76 additions & 239 deletions

File tree

Some content is hidden

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

datafusion/catalog-listing/src/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ mod tests {
462462
use std::ops::Not;
463463

464464
use super::*;
465-
use datafusion_expr::{Expr, case, col, lit};
465+
use datafusion_expr::{case, col};
466466

467467
#[test]
468468
fn test_split_files() {

datafusion/catalog-listing/src/table.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,6 @@ mod tests {
920920
use arrow::compute::SortOptions;
921921
use datafusion_physical_expr::expressions::Column;
922922
use datafusion_physical_expr_common::sort_expr::PhysicalSortExpr;
923-
use std::sync::Arc;
924923

925924
/// Helper to create a PhysicalSortExpr
926925
fn sort_expr(

datafusion/common/src/scalar/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5336,7 +5336,6 @@ impl ScalarType<i32> for Date32Type {
53365336

53375337
#[cfg(test)]
53385338
mod tests {
5339-
use std::sync::Arc;
53405339

53415340
use super::*;
53425341
use crate::cast::{as_list_array, as_map_array, as_struct_array};
@@ -5354,7 +5353,6 @@ mod tests {
53545353
};
53555354
use arrow::error::ArrowError;
53565355
use arrow::util::pretty::pretty_format_columns;
5357-
use chrono::NaiveDate;
53585356
use insta::assert_snapshot;
53595357
use rand::Rng;
53605358

datafusion/common/src/types/logical.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ mod tests {
143143
LogicalField, LogicalFields, logical_boolean, logical_date, logical_float32,
144144
logical_float64, logical_int32, logical_int64, logical_null, logical_string,
145145
};
146-
use arrow::datatypes::{DataType, Field, Fields};
146+
use arrow::datatypes::{Field, Fields};
147147
use insta::assert_snapshot;
148148

149149
#[test]

datafusion/common/src/types/native.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,6 @@ impl NativeType {
565565
mod tests {
566566
use super::*;
567567
use crate::types::LogicalField;
568-
use arrow::datatypes::Field;
569568
use insta::assert_snapshot;
570569

571570
#[test]

datafusion/core/src/dataframe/parquet.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ impl DataFrame {
107107
#[cfg(test)]
108108
mod tests {
109109
use std::collections::HashMap;
110-
use std::sync::Arc;
111110

112111
use super::super::Result;
113112
use super::*;

datafusion/core/src/datasource/listing_table_factory.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,17 +557,13 @@ mod tests {
557557

558558
#[tokio::test]
559559
async fn test_create_with_invalid_session() {
560-
use async_trait::async_trait;
561-
use datafusion_catalog::Session;
562-
use datafusion_common::Result;
563560
use datafusion_common::config::TableOptions;
564561
use datafusion_execution::TaskContext;
565562
use datafusion_execution::config::SessionConfig;
566563
use datafusion_physical_expr::PhysicalExpr;
567564
use datafusion_physical_plan::ExecutionPlan;
568565
use std::any::Any;
569566
use std::collections::HashMap;
570-
use std::sync::Arc;
571567

572568
// A mock Session that is NOT SessionState
573569
#[derive(Debug)]

datafusion/datasource-arrow/src/file_format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ mod tests {
557557
use datafusion_expr::execution_props::ExecutionProps;
558558
use datafusion_expr::{AggregateUDF, Expr, LogicalPlan, ScalarUDF, WindowUDF};
559559
use datafusion_physical_expr_common::physical_expr::PhysicalExpr;
560-
use object_store::{chunked::ChunkedStore, memory::InMemory, path::Path};
560+
use object_store::{chunked::ChunkedStore, memory::InMemory};
561561

562562
struct MockSession {
563563
config: SessionConfig,

datafusion/datasource-json/src/source.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,6 @@ mod tests {
523523
use arrow::datatypes::{DataType, Field, Schema};
524524
use bytes::Bytes;
525525
use datafusion_datasource::FileRange;
526-
use futures::TryStreamExt;
527526
use object_store::memory::InMemory;
528527
use object_store::path::Path;
529528
use object_store::{ObjectStoreExt, PutPayload};

datafusion/datasource-parquet/src/file_format.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,11 +1808,9 @@ async fn output_single_parquet_file_parallelized(
18081808
#[cfg(test)]
18091809
mod tests {
18101810
use parquet::arrow::parquet_to_arrow_schema;
1811-
use std::sync::Arc;
18121811

18131812
use super::*;
18141813

1815-
use arrow::datatypes::DataType;
18161814
use parquet::schema::parser::parse_message_type;
18171815

18181816
#[test]

0 commit comments

Comments
 (0)