From 9cc5e0aa27e0112861a7f8a47419d1920cebdb86 Mon Sep 17 00:00:00 2001 From: yangzhong Date: Mon, 19 Dec 2022 11:24:19 +0800 Subject: [PATCH] Fix cargo clippy --- ballista/core/src/execution_plans/shuffle_reader.rs | 2 +- ballista/core/src/plugin/mod.rs | 2 +- ballista/executor/src/executor_server.rs | 8 ++++---- ballista/scheduler/src/state/execution_graph.rs | 10 ++++------ benchmarks/src/bin/tpch.rs | 6 +++--- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ballista/core/src/execution_plans/shuffle_reader.rs b/ballista/core/src/execution_plans/shuffle_reader.rs index 5411978fc..97e24fd62 100644 --- a/ballista/core/src/execution_plans/shuffle_reader.rs +++ b/ballista/core/src/execution_plans/shuffle_reader.rs @@ -364,7 +364,7 @@ async fn fetch_partition_remote( // TODO for shuffle client connections, we should avoid creating new connections again and again. // And we should also avoid to keep alive too many connections for long time. let host = metadata.host.as_str(); - let port = metadata.port as u16; + let port = metadata.port; let mut ballista_client = BallistaClient::try_new(host, port) .await diff --git a/ballista/core/src/plugin/mod.rs b/ballista/core/src/plugin/mod.rs index 3579c5467..d18817136 100644 --- a/ballista/core/src/plugin/mod.rs +++ b/ballista/core/src/plugin/mod.rs @@ -50,7 +50,7 @@ impl PluginEnum { /// new a struct which impl the PluginRegistrar trait pub fn init_plugin_manager(&self) -> Box { match self { - PluginEnum::UDF => Box::new(UDFPluginManager::default()), + PluginEnum::UDF => Box::::default(), } } } diff --git a/ballista/executor/src/executor_server.rs b/ballista/executor/src/executor_server.rs index da7fb74f6..de4696d29 100644 --- a/ballista/executor/src/executor_server.rs +++ b/ballista/executor/src/executor_server.rs @@ -342,12 +342,12 @@ impl ExecutorServer ExecutorServer usize { self.stages - .iter() - .map(|(_, stage)| { + .values() + .map(|stage| { if let ExecutionStage::Running(stage) = stage { stage.available_tasks() } else { @@ -1412,8 +1410,8 @@ impl Debug for ExecutionGraph { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let stages = self .stages - .iter() - .map(|(_, stage)| format!("{:?}", stage)) + .values() + .map(|stage| format!("{:?}", stage)) .collect::>() .join(""); write!(f, "ExecutionGraph[job_id={}, session_id={}, available_tasks={}, is_successful={}]\n{}", diff --git a/benchmarks/src/bin/tpch.rs b/benchmarks/src/bin/tpch.rs index 10ff91ada..aabfea6ff 100644 --- a/benchmarks/src/bin/tpch.rs +++ b/benchmarks/src/bin/tpch.rs @@ -330,7 +330,7 @@ async fn benchmark_datafusion(opt: DataFusionBenchmarkOpt) -> Result Result<()> { .unwrap(); } let elapsed = start.elapsed().as_secs_f64() * 1000.0; - millis.push(elapsed as f64); + millis.push(elapsed); let row_count = batches.iter().map(|b| b.num_rows()).sum(); println!( "Query {} iteration {} took {:.1} ms and returned {} rows", @@ -556,7 +556,7 @@ fn get_query_sql_by_path(query: usize, mut sql_path: String) -> Result { } if query > 0 && query < 23 { let filename = format!("{}/q{}.sql", sql_path, query); - Ok(fs::read_to_string(&filename).expect("failed to read query")) + Ok(fs::read_to_string(filename).expect("failed to read query")) } else { Err(DataFusionError::Plan( "invalid query. Expected value between 1 and 22".to_owned(),