diff --git a/arrow_util/src/string.rs b/arrow_util/src/string.rs index d5816b23cf..d99f973510 100644 --- a/arrow_util/src/string.rs +++ b/arrow_util/src/string.rs @@ -89,7 +89,7 @@ impl + FromPrimitive + Zero> PackedStringArray { .push_str(&other.storage[first_offset..end_offset]); self.offsets.extend( - (&other.offsets[(range.start + 1)..(range.end + 1)]) + other.offsets[(range.start + 1)..(range.end + 1)] .iter() .map(|x| { K::from_usize(x.as_() - first_offset + insert_offset) diff --git a/influxdb_iox/src/commands/storage.rs b/influxdb_iox/src/commands/storage.rs index d30986d407..144a73cae4 100644 --- a/influxdb_iox/src/commands/storage.rs +++ b/influxdb_iox/src/commands/storage.rs @@ -255,7 +255,7 @@ pub async fn command(connection: Connection, config: Config) -> Result<()> { let mut client = influxdb_storage_client::Client::new(connection); // convert predicate with no root node into None. - let predicate = config.predicate.root.is_some().then(|| config.predicate); + let predicate = config.predicate.root.is_some().then_some(config.predicate); let source = Client::read_source(&config.db_name, 0); let now = std::time::Instant::now(); diff --git a/influxdb_tsm/src/reader.rs b/influxdb_tsm/src/reader.rs index eccd02b6ca..39759c295a 100644 --- a/influxdb_tsm/src/reader.rs +++ b/influxdb_tsm/src/reader.rs @@ -239,7 +239,7 @@ where T: BlockDecoder, { fn decode(&mut self, block: &Block) -> Result { - (&mut **self).decode(block) + (**self).decode(block) } } diff --git a/ingester/src/query.rs b/ingester/src/query.rs index a3d6bc8fb0..e346851f06 100644 --- a/ingester/src/query.rs +++ b/ingester/src/query.rs @@ -277,7 +277,7 @@ mod tests { // Merge schema of the batches // The fields in the schema are sorted by column name let batches = create_batches(); - let merged_schema = (&*merge_record_batch_schemas(&batches)).clone(); + let merged_schema = (*merge_record_batch_schemas(&batches)).clone(); // Expected Arrow schema let arrow_schema = Arc::new(arrow::datatypes::Schema::new(vec![ diff --git a/iox_catalog/src/mem.rs b/iox_catalog/src/mem.rs index c650e3a99b..e2febcc873 100644 --- a/iox_catalog/src/mem.rs +++ b/iox_catalog/src/mem.rs @@ -773,7 +773,7 @@ impl PartitionRepo for MemTxn { let table_ids: HashSet<_> = stage .tables .iter() - .filter_map(|table| (table.namespace_id == namespace_id).then(|| table.id)) + .filter_map(|table| (table.namespace_id == namespace_id).then_some(table.id)) .collect(); let partitions: Vec<_> = stage .partitions @@ -937,7 +937,7 @@ impl TombstoneRepo for MemTxn { let table_ids: HashSet<_> = stage .tables .iter() - .filter_map(|table| (table.namespace_id == namespace_id).then(|| table.id)) + .filter_map(|table| (table.namespace_id == namespace_id).then_some(table.id)) .collect(); let tombstones: Vec<_> = stage .tombstones @@ -1112,7 +1112,7 @@ impl ParquetFileRepo for MemTxn { let table_ids: HashSet<_> = stage .tables .iter() - .filter_map(|table| (table.namespace_id == namespace_id).then(|| table.id)) + .filter_map(|table| (table.namespace_id == namespace_id).then_some(table.id)) .collect(); let parquet_files: Vec<_> = stage .parquet_files diff --git a/iox_data_generator/src/specification.rs b/iox_data_generator/src/specification.rs index 75f3454956..64b1e3d3ea 100644 --- a/iox_data_generator/src/specification.rs +++ b/iox_data_generator/src/specification.rs @@ -160,13 +160,7 @@ impl DataSpec { /// Get the agent spec by its name pub fn agent_by_name(&self, name: &str) -> Option<&AgentSpec> { - for a in &self.agents { - if a.name == name { - return Some(a); - } - } - - None + self.agents.iter().find(|&a| a.name == name) } } diff --git a/iox_query/src/frontend/influxrpc.rs b/iox_query/src/frontend/influxrpc.rs index 2f298ea221..0940aff71b 100644 --- a/iox_query/src/frontend/influxrpc.rs +++ b/iox_query/src/frontend/influxrpc.rs @@ -265,7 +265,8 @@ impl InfluxRpcPlanner { } } - Ok((!chunks_full.is_empty()).then(|| (table_name, Some((predicate, chunks_full))))) + Ok((!chunks_full.is_empty()) + .then_some((table_name, Some((predicate, chunks_full))))) }) .try_collect() .await?; @@ -1371,7 +1372,7 @@ where // rustc seems to heavily confused about the filter step here, esp. it dislikes `.try_filter` and even // `.try_filter_map` requires some additional type annotations .try_filter_map(|(table_name, predicate, chunks)| async move { - Ok((!chunks.is_empty()).then(move || (table_name, predicate, chunks))) + Ok((!chunks.is_empty()).then_some((table_name, predicate, chunks))) as Result)>> }) .and_then(|(table_name, predicate, chunks)| { diff --git a/querier/src/system_tables/queries.rs b/querier/src/system_tables/queries.rs index cbbf4bc69a..ab080898da 100644 --- a/querier/src/system_tables/queries.rs +++ b/querier/src/system_tables/queries.rs @@ -43,10 +43,7 @@ impl IoxSystemTable for QueriesTable { let mut entries = self.query_log.entries(); if let Some(namespace_id) = self.namespace_id_filter { - entries = entries - .into_iter() - .filter(|entry| entry.namespace_id == namespace_id) - .collect(); + entries.retain(|entry| entry.namespace_id == namespace_id); } let mut offset = 0; diff --git a/read_buffer/src/column/encoding/scalar/rle.rs b/read_buffer/src/column/encoding/scalar/rle.rs index 25e36c623e..b7dca24b11 100644 --- a/read_buffer/src/column/encoding/scalar/rle.rs +++ b/read_buffer/src/column/encoding/scalar/rle.rs @@ -381,7 +381,7 @@ where + self .run_lengths .iter() - .filter_map(|(rl, v)| v.is_some().then(|| *rl as usize * size_of::>())) + .filter_map(|(rl, v)| v.is_some().then_some(*rl as usize * size_of::>())) .sum::() } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 993f2cc7ee..7aafa901b3 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.63" +channel = "1.64" components = [ "rustfmt", "clippy" ] diff --git a/write_buffer/src/codec.rs b/write_buffer/src/codec.rs index 1f290c2b5c..0b89c9c0ca 100644 --- a/write_buffer/src/codec.rs +++ b/write_buffer/src/codec.rs @@ -99,7 +99,7 @@ impl IoxHeaders { span_context = match parser.parse(trace_collector, &headers) { Ok(None) => None, - Ok(Some(ctx)) => ctx.sampled.then(|| ctx), + Ok(Some(ctx)) => ctx.sampled.then_some(ctx), Err(e) => { return Err(WriteBufferError::invalid_data(format!( "Error decoding trace context: {}",