chore: Update Rust version (#1445)

* chore: Update Rust version

* refactor: Make struct constructor field orderings consistent

Sometimes I changed the struct definition, sometimes changed the struct
construction instance, depending on consistency with code around each
(other similar structs, function argument orders, etc)

More info: https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_struct_constructor

* refactor: Use flatten where appropriate

One instance is a false positive with a clippy bug.

More info:

- https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_identity
- https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten

* refactor: Use Option map instead of match

More info: https://rust-lang.github.io/rust-clippy/master/index.html#manual_map

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/24376/head
Carol (Nichols || Goulding) 2021-05-06 18:07:10 -04:00 committed by GitHub
parent 15831a4e75
commit febc1538ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 17 deletions

View File

@ -474,8 +474,8 @@ impl Client {
self.inner
.new_partition_chunk(NewPartitionChunkRequest {
db_name,
table_name,
partition_key,
table_name,
})
.await
.map_err(|status| match status.code() {

View File

@ -459,6 +459,7 @@ impl BlockData {
/// overwrites previous values. Therefore, in order to have "last write
/// wins" semantics it is important that the provided vector of blocks
/// is ordered by the wall-clock time the blocks were created.
#[allow(clippy::manual_flatten)] // https://github.com/rust-lang/rust-clippy/issues/6784
pub fn merge(mut blocks: Vec<Self>) -> Self {
if blocks.is_empty() {
panic!("merge called with zero blocks");

View File

@ -36,7 +36,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
///
pub fn estimate_cardinality(array: &DictionaryArray<Int32Type>) -> usize {
let keys = array.keys();
let group: HashSet<_> = keys.iter().filter_map(|x| x).collect();
let group: HashSet<_> = keys.iter().flatten().collect();
group.len()
}

View File

@ -162,11 +162,9 @@ impl Domain {
suffix: Option<&str>,
) -> String {
let mut ret = self.name.to_string();
for s in &[subname, Some(metric_name), unit, suffix] {
if let Some(s) = s {
for s in [subname, Some(metric_name), unit, suffix].iter().flatten() {
ret.push('.');
ret.push_str(s)
}
ret.push_str(s);
}
ret
}

View File

@ -71,9 +71,9 @@ impl Display for RedRequestStatus {
/// Using a `REDMetric` makes following this methodology easy because it handles
/// updating the three components for you.
pub struct RedMetric {
default_labels: Vec<KeyValue>,
requests: OTCounter<u64>,
duration: OTHistogram<f64>,
default_labels: Vec<KeyValue>,
}
impl RedMetric {
@ -370,8 +370,8 @@ impl Gauge {
/// A Histogram is a metric exposing a distribution of observations.
#[derive(Debug)]
pub struct Histogram {
default_labels: Vec<KeyValue>,
histogram: OTHistogram<f64>,
default_labels: Vec<KeyValue>,
}
impl Histogram {

View File

@ -348,11 +348,8 @@ impl SeriesSetConverter {
batch.schema().fields()[*column_index]
),
};
if let Some(tag_value) = tag_value {
Some((Arc::clone(&column_name), Arc::from(tag_value.as_str())))
} else {
None
}
tag_value.map(|tag_value| (Arc::clone(&column_name), Arc::from(tag_value.as_str())))
})
.collect()
}

View File

@ -1 +1 @@
1.51.0
1.52.0

View File

@ -158,9 +158,9 @@ pub enum Error {
source
))]
ReadBufferChunkTimestampError {
chunk_id: u32,
table_name: String,
source: read_buffer::Error,
table_name: String,
chunk_id: u32,
},
#[snafu(display("Error writing to object store: {}", source))]