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>
pull/24376/head
Carol (Nichols || Goulding) 2023-03-12 09:22:20 -04:00 committed by GitHub
parent 5c00819727
commit cc7c44f76a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 16 deletions

View File

@ -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::<Result<Vec<_>>>();
let lines = parse_lines(&str).collect::<Result<Vec<_>>>();
match lines {
Ok(_) => std::ptr::null(),
Err(e) => CString::new(e.to_string()).unwrap().into_raw() as *const _,

View File

@ -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,
}]
);

View File

@ -126,7 +126,6 @@ impl Agent {
generated_tag_sets: &GeneratedTagSets,
) -> Result<Vec<Self>> {
let agents: Vec<_> = (1..count + 1)
.into_iter()
.map(|agent_id| {
let data = json!({"agent": {"id": agent_id, "name": agent_spec.name}});

View File

@ -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.

View File

@ -224,20 +224,20 @@ impl Column {
pub fn size(&self) -> usize {
let data_size = match &self.data {
ColumnData::F64(v, stats) => {
mem::size_of::<f64>() * v.capacity() + mem::size_of_val(&stats)
mem::size_of::<f64>() * v.capacity() + mem::size_of_val(stats)
}
ColumnData::I64(v, stats) => {
mem::size_of::<i64>() * v.capacity() + mem::size_of_val(&stats)
mem::size_of::<i64>() * v.capacity() + mem::size_of_val(stats)
}
ColumnData::U64(v, stats) => {
mem::size_of::<u64>() * v.capacity() + mem::size_of_val(&stats)
mem::size_of::<u64>() * 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::<DID>() * v.capacity() + dictionary.size() + mem::size_of_val(&stats)
mem::size_of::<DID>() * 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::<Self>() + data_size + self.valid.byte_len()

View File

@ -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(

View File

@ -1,3 +1,3 @@
[toolchain]
channel = "1.67"
channel = "1.68"
components = [ "rustfmt", "clippy" ]

View File

@ -559,7 +559,6 @@ impl WriteBufferStreamHandler for MockBufferStreamHandler {
impl WriteBufferReading for MockBufferForReading {
fn shard_indexes(&self) -> BTreeSet<ShardIndex> {
(0..self.n_shards)
.into_iter()
.map(|i| ShardIndex::new(i as i32))
.collect()
}