Apache DataFusion SQL Query Engine
Remove uses of #[allow(dead_code)] in favor of _identifier (#13328)
ding-young3a7dde3a1f97
diff --git a/datafusion-examples/examples/advanced_parquet_index.rs b/datafusion-examples/examples/advanced_parquet_index.rsindex f6860bb5b8..67b745d407 100644--- a/datafusion-examples/examples/advanced_parquet_index.rs+++ b/datafusion-examples/examples/advanced_parquet_index.rs@@ -229,9 +229,9 @@ async fn main() -> Result<()> {/// `file1.parquet` contains values `0..1000`#[derive(Debug)]pub struct IndexTableProvider {- /// Where the file is stored (cleanup on drop)- #[allow(dead_code)]- tmpdir: TempDir,+ /// Pointer to temporary file storage. Keeping it in scope to prevent temporary folder+ /// to be deleted prematurely+ _tmpdir: TempDir,/// The file that is being read.indexed_file: IndexedFile,/// The underlying object store@@ -250,7 +250,7 @@ impl IndexTableProvider {Ok(Self {indexed_file,- tmpdir,+ _tmpdir: tmpdir,object_store,use_row_selections: AtomicBool::new(false),})diff --git a/datafusion/core/tests/parquet/external_access_plan.rs b/datafusion/core/tests/parquet/external_access_plan.rsindex 03afc858df..96267eeff5 100644--- a/datafusion/core/tests/parquet/external_access_plan.rs+++ b/datafusion/core/tests/parquet/external_access_plan.rs@@ -313,7 +313,7 @@ impl TestFull {} = self;let TestData {- temp_file: _,+ _temp_file: _,schema,file_name,file_size,@@ -361,9 +361,9 @@ impl TestFull {// Holds necessary data for these tests to reuse the same parquet filestruct TestData {- // field is present as on drop the file is deleted- #[allow(dead_code)]- temp_file: NamedTempFile,+ /// Pointer to temporary file storage. Keeping it in scope to prevent temporary folder+ /// to be deleted prematurely+ _temp_file: NamedTempFile,schema: SchemaRef,file_name: String,file_size: u64,@@ -402,7 +402,7 @@ fn get_test_data() -> &'static TestData {let file_size = temp_file.path().metadata().unwrap().len();TestData {- temp_file,+ _temp_file: temp_file,schema,file_name,file_size,diff --git a/datafusion/core/tests/parquet/mod.rs b/datafusion/core/tests/parquet/mod.rsindex cfa2a3df3b..cd298d1c55 100644--- a/datafusion/core/tests/parquet/mod.rs+++ b/datafusion/core/tests/parquet/mod.rs@@ -100,10 +100,9 @@ enum Unit {/// table "t" registered, pointing at a parquet file made with/// `make_test_file`struct ContextWithParquet {- #[allow(dead_code)]/// temp file parquet data is written to. The file is cleaned up/// when dropped- file: NamedTempFile,+ _file: NamedTempFile,provider: Arc<dyn TableProvider>,ctx: SessionContext,}@@ -217,7 +216,7 @@ impl ContextWithParquet {ctx.register_table("t", provider.clone()).unwrap();Self {- file,+ _file: file,provider,ctx,}diff --git a/datafusion/execution/src/disk_manager.rs b/datafusion/execution/src/disk_manager.rsindex 38c259fcbd..c71071b809 100644--- a/datafusion/execution/src/disk_manager.rs+++ b/datafusion/execution/src/disk_manager.rs@@ -139,7 +139,7 @@ impl DiskManager {let dir_index = thread_rng().gen_range(0..local_dirs.len());Ok(RefCountedTempFile {- parent_temp_dir: Arc::clone(&local_dirs[dir_index]),+ _parent_temp_dir: Arc::clone(&local_dirs[dir_index]),tempfile: Builder::new().tempfile_in(local_dirs[dir_index].as_ref()).map_err(DataFusionError::IoError)?,@@ -153,8 +153,7 @@ impl DiskManager {pub struct RefCountedTempFile {/// The reference to the directory in which temporary files are created to ensure/// it is not cleaned up prior to the NamedTempFile- #[allow(dead_code)]- parent_temp_dir: Arc<TempDir>,+ _parent_temp_dir: Arc<TempDir>,tempfile: NamedTempFile,}diff --git a/datafusion/physical-plan/src/joins/cross_join.rs b/datafusion/physical-plan/src/joins/cross_join.rsindex 7f785006f7..f53fe13df1 100644--- a/datafusion/physical-plan/src/joins/cross_join.rs+++ b/datafusion/physical-plan/src/joins/cross_join.rs@@ -53,8 +53,7 @@ struct JoinLeftData {merged_batch: RecordBatch,/// Track memory reservation for merged_batch. Relies on drop/// semantics to release reservation when JoinLeftData is dropped.- #[allow(dead_code)]- reservation: MemoryReservation,+ _reservation: MemoryReservation,}#[allow(rustdoc::private_intra_doc_links)]@@ -209,7 +208,7 @@ async fn load_left_input(Ok(JoinLeftData {merged_batch,- reservation,+ _reservation: reservation,})}diff --git a/datafusion/physical-plan/src/joins/hash_join.rs b/datafusion/physical-plan/src/joins/hash_join.rsindex 32267b1181..8ab292c142 100644--- a/datafusion/physical-plan/src/joins/hash_join.rs+++ b/datafusion/physical-plan/src/joins/hash_join.rs@@ -92,8 +92,7 @@ struct JoinLeftData {probe_threads_counter: AtomicUsize,/// Memory reservation that tracks memory used by `hash_map` hash table/// `batch`. Cleared on drop.- #[allow(dead_code)]- reservation: MemoryReservation,+ _reservation: MemoryReservation,}impl JoinLeftData {@@ -110,7 +109,7 @@ impl JoinLeftData {batch,visited_indices_bitmap,probe_threads_counter,- reservation,+ _reservation: reservation,}}diff --git a/datafusion/physical-plan/src/joins/nested_loop_join.rs b/datafusion/physical-plan/src/joins/nested_loop_join.rsindex 71c617a963..2beeb92da4 100644--- a/datafusion/physical-plan/src/joins/nested_loop_join.rs+++ b/datafusion/physical-plan/src/joins/nested_loop_join.rs@@ -69,8 +69,7 @@ struct JoinLeftData {probe_threads_counter: AtomicUsize,/// Memory reservation for tracking batch and bitmap/// Cleared on `JoinLeftData` drop- #[allow(dead_code)]- reservation: MemoryReservation,+ _reservation: MemoryReservation,}impl JoinLeftData {@@ -78,13 +77,13 @@ impl JoinLeftData {batch: RecordBatch,bitmap: SharedBitmapBuilder,probe_threads_counter: AtomicUsize,- reservation: MemoryReservation,+ _reservation: MemoryReservation,) -> Self {Self {batch,bitmap,probe_threads_counter,- reservation,+ _reservation,}}diff --git a/datafusion/physical-plan/src/repartition/mod.rs b/datafusion/physical-plan/src/repartition/mod.rsindex 1730c7d8dc..0a80dcd34e 100644--- a/datafusion/physical-plan/src/repartition/mod.rs+++ b/datafusion/physical-plan/src/repartition/mod.rs@@ -623,7 +623,7 @@ impl ExecutionPlan for RepartitionExec {Box::pin(PerPartitionStream {schema: Arc::clone(&schema_captured),receiver,- drop_helper: Arc::clone(&abort_helper),+ _drop_helper: Arc::clone(&abort_helper),reservation: Arc::clone(&reservation),}) as SendableRecordBatchStream})@@ -651,7 +651,7 @@ impl ExecutionPlan for RepartitionExec {num_input_partitions_processed: 0,schema: input.schema(),input: rx.swap_remove(0),- drop_helper: abort_helper,+ _drop_helper: abort_helper,reservation,}) as SendableRecordBatchStream)}@@ -906,8 +906,7 @@ struct RepartitionStream {input: DistributionReceiver<MaybeBatch>,/// Handle to ensure background tasks are killed when no longer needed.- #[allow(dead_code)]- drop_helper: Arc<Vec<SpawnedTask<()>>>,+ _drop_helper: Arc<Vec<SpawnedTask<()>>>,/// Memory reservation.reservation: SharedMemoryReservation,@@ -970,8 +969,7 @@ struct PerPartitionStream {receiver: DistributionReceiver<MaybeBatch>,/// Handle to ensure background tasks are killed when no longer needed.- #[allow(dead_code)]- drop_helper: Arc<Vec<SpawnedTask<()>>>,+ _drop_helper: Arc<Vec<SpawnedTask<()>>>,/// Memory reservation.reservation: SharedMemoryReservation,diff --git a/datafusion/physical-plan/src/sorts/cursor.rs b/datafusion/physical-plan/src/sorts/cursor.rsindex 133d736c14..5cd24b89f5 100644--- a/datafusion/physical-plan/src/sorts/cursor.rs+++ b/datafusion/physical-plan/src/sorts/cursor.rs@@ -156,8 +156,7 @@ pub struct RowValues {/// Tracks for the memory used by in the `Rows` of this/// cursor. Freed on drop- #[allow(dead_code)]- reservation: MemoryReservation,+ _reservation: MemoryReservation,}impl RowValues {@@ -173,7 +172,10 @@ impl RowValues {"memory reservation mismatch");assert!(rows.num_rows() > 0);- Self { rows, reservation }+ Self {+ rows,+ _reservation: reservation,+ }}}