From cc7c44f76a2f79f85c638a357b20d24715d89712 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" <193874+carols10cents@users.noreply.github.com> Date: Sun, 12 Mar 2023 09:22:20 -0400 Subject: [PATCH] chore: Upgrade to Rust 1.68 (#7175) * chore: Upgrade to Rust 1.68 * fix: Remove unnecessary into_iter, thanks Clippy! * fix: Use the size of the type, not a reference to the type... oops. Thanks clippy! * fix: Return block directly instead of creating a variable Thanks clippy! --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- influxdb_line_protocol/src/ffi.rs | 2 +- ingester/src/buffer_tree/table.rs | 2 +- iox_data_generator/src/agent.rs | 1 - iox_query/src/frontend/influxrpc.rs | 6 ++---- mutable_batch/src/column.rs | 12 ++++++------ mutable_batch/tests/writer.rs | 2 +- rust-toolchain.toml | 2 +- write_buffer/src/mock.rs | 1 - 8 files changed, 12 insertions(+), 16 deletions(-) diff --git a/influxdb_line_protocol/src/ffi.rs b/influxdb_line_protocol/src/ffi.rs index 4ff2714138..b98215abc8 100644 --- a/influxdb_line_protocol/src/ffi.rs +++ b/influxdb_line_protocol/src/ffi.rs @@ -13,7 +13,7 @@ pub unsafe extern "C" fn validate_lines(lp: *const libc::c_char) -> *const libc: catch_unwind(|| { let bytes = CStr::from_ptr(lp).to_bytes(); let str = String::from_utf8(bytes.to_vec()).unwrap(); - let lines = parse_lines(&str).into_iter().collect::>>(); + let lines = parse_lines(&str).collect::>>(); match lines { Ok(_) => std::ptr::null(), Err(e) => CString::new(e.to_string()).unwrap().into_raw() as *const _, diff --git a/ingester/src/buffer_tree/table.rs b/ingester/src/buffer_tree/table.rs index 98acc9149c..8341e57f78 100644 --- a/ingester/src/buffer_tree/table.rs +++ b/ingester/src/buffer_tree/table.rs @@ -418,7 +418,7 @@ mod tests { namespace_id: NAMESPACE_ID, table_id: TABLE_ID, sequence_number: SequenceNumber::new(42), - bytes_written: 1099, + bytes_written: 1283, rows_written: 1, }] ); diff --git a/iox_data_generator/src/agent.rs b/iox_data_generator/src/agent.rs index b7dcded643..aeed2844a8 100644 --- a/iox_data_generator/src/agent.rs +++ b/iox_data_generator/src/agent.rs @@ -126,7 +126,6 @@ impl Agent { generated_tag_sets: &GeneratedTagSets, ) -> Result> { let agents: Vec<_> = (1..count + 1) - .into_iter() .map(|agent_id| { let data = json!({"agent": {"id": agent_id, "name": agent_spec.name}}); diff --git a/iox_query/src/frontend/influxrpc.rs b/iox_query/src/frontend/influxrpc.rs index 473366f958..c2bdb31f0a 100644 --- a/iox_query/src/frontend/influxrpc.rs +++ b/iox_query/src/frontend/influxrpc.rs @@ -1509,7 +1509,7 @@ fn columns_in_predicates( .collect(); let val_exprs_cols_result = exprlist_to_columns(&exprs, &mut columns).context(ReadColumnsSnafu); - let projection = if expr_cols_result.is_err() || val_exprs_cols_result.is_err() { + if expr_cols_result.is_err() || val_exprs_cols_result.is_err() { if expr_cols_result.is_err() { let error_message = expr_cols_result.err().unwrap().to_string(); warn!(table_name, ?predicate.exprs, ?error_message, "cannot determine columns in predicate.exprs"); @@ -1541,9 +1541,7 @@ fn columns_in_predicates( } } Some(indices) - }; - - projection + } } /// Create plans that fetch the data specified in table_predicates. diff --git a/mutable_batch/src/column.rs b/mutable_batch/src/column.rs index b85ff4948d..be813a78f6 100644 --- a/mutable_batch/src/column.rs +++ b/mutable_batch/src/column.rs @@ -224,20 +224,20 @@ impl Column { pub fn size(&self) -> usize { let data_size = match &self.data { ColumnData::F64(v, stats) => { - mem::size_of::() * v.capacity() + mem::size_of_val(&stats) + mem::size_of::() * v.capacity() + mem::size_of_val(stats) } ColumnData::I64(v, stats) => { - mem::size_of::() * v.capacity() + mem::size_of_val(&stats) + mem::size_of::() * v.capacity() + mem::size_of_val(stats) } ColumnData::U64(v, stats) => { - mem::size_of::() * v.capacity() + mem::size_of_val(&stats) + mem::size_of::() * v.capacity() + mem::size_of_val(stats) } - ColumnData::Bool(v, stats) => v.byte_len() + mem::size_of_val(&stats), + ColumnData::Bool(v, stats) => v.byte_len() + mem::size_of_val(stats), ColumnData::Tag(v, dictionary, stats) => { - mem::size_of::() * v.capacity() + dictionary.size() + mem::size_of_val(&stats) + mem::size_of::() * v.capacity() + dictionary.size() + mem::size_of_val(stats) } ColumnData::String(v, stats) => { - v.size() + mem::size_of_val(&stats) + stats.string_size() + v.size() + mem::size_of_val(stats) + stats.string_size() } }; mem::size_of::() + data_size + self.valid.byte_len() diff --git a/mutable_batch/tests/writer.rs b/mutable_batch/tests/writer.rs index 8f4533441e..87da6b5557 100644 --- a/mutable_batch/tests/writer.rs +++ b/mutable_batch/tests/writer.rs @@ -213,7 +213,7 @@ fn test_basic() { let mut writer = Writer::new(&mut batch, 17); - writer.write_time("time", (0..17).into_iter()).unwrap(); + writer.write_time("time", 0..17).unwrap(); writer .write_f64( diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 0063295b0a..fcb51a8a44 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.67" +channel = "1.68" components = [ "rustfmt", "clippy" ] diff --git a/write_buffer/src/mock.rs b/write_buffer/src/mock.rs index 8f0d01a0c2..c5e9c683c8 100644 --- a/write_buffer/src/mock.rs +++ b/write_buffer/src/mock.rs @@ -559,7 +559,6 @@ impl WriteBufferStreamHandler for MockBufferStreamHandler { impl WriteBufferReading for MockBufferForReading { fn shard_indexes(&self) -> BTreeSet { (0..self.n_shards) - .into_iter() .map(|i| ShardIndex::new(i as i32)) .collect() }