Skip to content

Commit 4edbdd7

Browse files
authored
fix: cargo warnings of import item (#10196)
* fix: cargo warnings of import item Signed-off-by: Ruihang Xia <[email protected]> * deny unused imports Signed-off-by: Ruihang Xia <[email protected]> * allow util macro re-export Signed-off-by: Ruihang Xia <[email protected]> * lift windows target feature gate to mod level Signed-off-by: Ruihang Xia <[email protected]> --------- Signed-off-by: Ruihang Xia <[email protected]>
1 parent fe268bc commit 4edbdd7

File tree

143 files changed

+140
-436
lines changed

Some content is hidden

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

143 files changed

+140
-436
lines changed

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
run: cargo check --all-targets --no-default-features -p datafusion-functions
7878

7979
- name: Check workspace in debug mode
80-
run: cargo check
80+
run: cargo check --all-targets --workspace
8181

8282
- name: Check workspace with avro,json features
8383
run: cargo check --workspace --benches --features avro,json

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,6 @@ rpath = false
130130
[workspace.lints.clippy]
131131
# Detects large stack-allocated futures that may cause stack overflow crashes (see threshold in clippy.toml)
132132
large_futures = "warn"
133+
134+
[workspace.lints.rust]
135+
unused_imports = "deny"

datafusion-examples/examples/custom_datasource.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use std::time::Duration;
2424
use datafusion::arrow::array::{UInt64Builder, UInt8Builder};
2525
use datafusion::arrow::datatypes::{DataType, Field, Schema, SchemaRef};
2626
use datafusion::arrow::record_batch::RecordBatch;
27-
use datafusion::dataframe::DataFrame;
2827
use datafusion::datasource::{provider_as_source, TableProvider, TableType};
2928
use datafusion::error::Result;
3029
use datafusion::execution::context::{SessionState, TaskContext};
@@ -34,7 +33,7 @@ use datafusion::physical_plan::{
3433
Partitioning, PlanProperties, SendableRecordBatchStream,
3534
};
3635
use datafusion::prelude::*;
37-
use datafusion_expr::{Expr, LogicalPlanBuilder};
36+
use datafusion_expr::LogicalPlanBuilder;
3837
use datafusion_physical_expr::EquivalenceProperties;
3938

4039
use async_trait::async_trait;

datafusion-examples/examples/flight/flight_client.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// under the License.
1717

1818
use std::collections::HashMap;
19-
use std::convert::TryFrom;
2019
use std::sync::Arc;
2120

2221
use datafusion::arrow::datatypes::Schema;

datafusion-examples/examples/simple_udaf.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use datafusion::arrow::{
2323
use datafusion::{error::Result, physical_plan::Accumulator};
2424
use datafusion::{logical_expr::Volatility, prelude::*, scalar::ScalarValue};
2525
use datafusion_common::cast::as_float64_array;
26-
use datafusion_expr::create_udaf;
2726
use std::sync::Arc;
2827

2928
// create local session context with an in-memory table

datafusion-examples/examples/simple_udwf.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use arrow::{
2222
datatypes::Float64Type,
2323
};
2424
use arrow_schema::DataType;
25-
use datafusion::datasource::file_format::options::CsvReadOptions;
2625

2726
use datafusion::error::Result;
2827
use datafusion::prelude::*;

datafusion/common/src/column.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ impl fmt::Display for Column {
373373
mod tests {
374374
use super::*;
375375
use arrow::datatypes::DataType;
376-
use arrow_schema::{Field, SchemaBuilder};
376+
use arrow_schema::SchemaBuilder;
377377

378378
fn create_qualified_schema(qualifier: &str, names: Vec<&str>) -> Result<DFSchema> {
379379
let mut schema_builder = SchemaBuilder::new();

datafusion/common/src/dfschema.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
//! fields with optional relation names.
2020
2121
use std::collections::{BTreeSet, HashMap, HashSet};
22-
use std::convert::TryFrom;
2322
use std::fmt::{Display, Formatter};
2423
use std::hash::Hash;
2524
use std::sync::Arc;
@@ -453,7 +452,7 @@ impl DFSchema {
453452
let matches = self.qualified_fields_with_unqualified_name(name);
454453
match matches.len() {
455454
0 => Err(unqualified_field_not_found(name, self)),
456-
1 => Ok((matches[0].0, &matches[0].1)),
455+
1 => Ok((matches[0].0, (matches[0].1))),
457456
_ => {
458457
// When `matches` size > 1, it doesn't necessarily mean an `ambiguous name` problem.
459458
// Because name may generate from Alias/... . It means that it don't own qualifier.
@@ -1004,7 +1003,6 @@ mod tests {
10041003
use crate::assert_contains;
10051004

10061005
use super::*;
1007-
use arrow::datatypes::DataType;
10081006

10091007
#[test]
10101008
fn qualifier_in_name() -> Result<()> {

datafusion/common/src/hash_utils.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use arrow::array::*;
2424
use arrow::datatypes::*;
2525
use arrow::row::Rows;
2626
use arrow::{downcast_dictionary_array, downcast_primitive_array};
27-
use arrow_buffer::i256;
2827

2928
use crate::cast::{
3029
as_boolean_array, as_fixed_size_list_array, as_generic_binary_array,
@@ -450,7 +449,6 @@ pub fn create_row_hashes_v2<'a>(
450449
#[cfg(test)]
451450
mod tests {
452451
use arrow::{array::*, datatypes::*};
453-
use std::sync::Arc;
454452

455453
use super::*;
456454

datafusion/common/src/scalar/mod.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mod struct_builder;
2222
use std::borrow::Borrow;
2323
use std::cmp::Ordering;
2424
use std::collections::{HashSet, VecDeque};
25-
use std::convert::{Infallible, TryFrom, TryInto};
25+
use std::convert::Infallible;
2626
use std::fmt;
2727
use std::hash::Hash;
2828
use std::iter::repeat;
@@ -52,7 +52,6 @@ use arrow::{
5252
UInt16Type, UInt32Type, UInt64Type, UInt8Type, DECIMAL128_MAX_PRECISION,
5353
},
5454
};
55-
use arrow_array::{ArrowNativeTypeOp, Scalar};
5655
use arrow_buffer::Buffer;
5756
use arrow_schema::{UnionFields, UnionMode};
5857

@@ -3424,8 +3423,6 @@ impl ScalarType<i32> for Date32Type {
34243423

34253424
#[cfg(test)]
34263425
mod tests {
3427-
use std::cmp::Ordering;
3428-
use std::sync::Arc;
34293426

34303427
use super::*;
34313428
use crate::cast::{
@@ -3435,9 +3432,7 @@ mod tests {
34353432
use crate::assert_batches_eq;
34363433
use arrow::buffer::OffsetBuffer;
34373434
use arrow::compute::{is_null, kernels};
3438-
use arrow::datatypes::{ArrowNumericType, ArrowPrimitiveType};
34393435
use arrow::util::pretty::pretty_format_columns;
3440-
use arrow_buffer::Buffer;
34413436
use arrow_schema::Fields;
34423437
use chrono::NaiveDate;
34433438
use rand::Rng;

0 commit comments

Comments
 (0)