diff --git a/influxdb2_client/src/api/label.rs b/influxdb2_client/src/api/label.rs index 40bfd9b378..fe59f68c49 100644 --- a/influxdb2_client/src/api/label.rs +++ b/influxdb2_client/src/api/label.rs @@ -9,12 +9,12 @@ use std::collections::HashMap; impl Client { /// List all Labels pub async fn labels(&self) -> Result<LabelsResponse, RequestError> { - Ok(self.get_labels(None).await?) + self.get_labels(None).await } /// List all Labels by organization ID pub async fn labels_by_org(&self, org_id: &str) -> Result<LabelsResponse, RequestError> { - Ok(self.get_labels(Some(org_id)).await?) + self.get_labels(Some(org_id)).await } async fn get_labels(&self, org_id: Option<&str>) -> Result<LabelsResponse, RequestError> { diff --git a/influxdb2_client/src/api/write.rs b/influxdb2_client/src/api/write.rs index 8157cbdaf3..cb9c3561ea 100644 --- a/influxdb2_client/src/api/write.rs +++ b/influxdb2_client/src/api/write.rs @@ -55,7 +55,7 @@ impl Client { let body = Body::wrap_stream(body); - Ok(self.write_line_protocol(org, bucket, body).await?) + self.write_line_protocol(org, bucket, body).await } } diff --git a/influxdb_iox_client/src/client/operations.rs b/influxdb_iox_client/src/client/operations.rs index 9b997c8c60..eeea122569 100644 --- a/influxdb_iox_client/src/client/operations.rs +++ b/influxdb_iox_client/src/client/operations.rs @@ -54,15 +54,14 @@ impl Client { /// Get information about a specific operation pub async fn get_operation(&mut self, id: usize) -> Result<IoxOperation, Error> { - Ok(self - .inner + self.inner .get_operation(GetOperationRequest { name: id.to_string(), }) .await? .into_inner() .try_into() - .map_err(Error::InvalidResponse)?) + .map_err(Error::InvalidResponse) } /// Cancel a given operation @@ -83,8 +82,7 @@ impl Client { id: usize, timeout: Option<std::time::Duration>, ) -> Result<IoxOperation, Error> { - Ok(self - .inner + self.inner .wait_operation(WaitOperationRequest { name: id.to_string(), timeout: timeout.map(Into::into), @@ -92,6 +90,6 @@ impl Client { .await? .into_inner() .try_into() - .map_err(Error::InvalidResponse)?) + .map_err(Error::InvalidResponse) } } diff --git a/iox_catalog/src/lib.rs b/iox_catalog/src/lib.rs index c491c3f07d..8b02f5845d 100644 --- a/iox_catalog/src/lib.rs +++ b/iox_catalog/src/lib.rs @@ -66,6 +66,8 @@ where } } +// &mut Cow is used to avoid a copy, so allow it +#[allow(clippy::ptr_arg)] async fn validate_mutable_batch<R>( mb: &MutableBatch, table_name: &str, diff --git a/lifecycle/src/policy.rs b/lifecycle/src/policy.rs index fa2e3bf27f..ec34475732 100644 --- a/lifecycle/src/policy.rs +++ b/lifecycle/src/policy.rs @@ -615,7 +615,7 @@ struct FreeCandidate<'a, P> { access_metrics: AccessMetrics, } -fn sort_free_candidates<P>(candidates: &mut Vec<FreeCandidate<'_, P>>) { +fn sort_free_candidates<P>(candidates: &mut [FreeCandidate<'_, P>]) { candidates.sort_unstable_by(|a, b| match a.action.cmp(&b.action) { // Order candidates with the same FreeAction by last access time std::cmp::Ordering::Equal => a diff --git a/mutable_batch/src/payload/filter.rs b/mutable_batch/src/payload/filter.rs index 37d0d2257a..83bffb1d60 100644 --- a/mutable_batch/src/payload/filter.rs +++ b/mutable_batch/src/payload/filter.rs @@ -146,8 +146,7 @@ mod tests { let expected: Vec<_> = ranges .iter() - .cloned() - .flatten() + .flat_map(|r| r.clone()) .filter(|idx| predicate(data[*idx])) .collect(); diff --git a/mutable_batch/tests/writer_fuzz.rs b/mutable_batch/tests/writer_fuzz.rs index dc080a69e1..e46c6f5a2c 100644 --- a/mutable_batch/tests/writer_fuzz.rs +++ b/mutable_batch/tests/writer_fuzz.rs @@ -87,8 +87,7 @@ struct Expected { fn filter_vec<T: Clone>(ranges: &[Range<usize>], src: &[T]) -> Vec<T> { ranges .iter() - .cloned() - .flatten() + .flat_map(|r| r.clone()) .map(|x| src[x].clone()) .collect() } diff --git a/parquet_catalog/src/core.rs b/parquet_catalog/src/core.rs index cd75f9ad4d..f856f35c4d 100644 --- a/parquet_catalog/src/core.rs +++ b/parquet_catalog/src/core.rs @@ -303,7 +303,7 @@ impl PreservedCatalog { /// /// Note that wiping the catalog will NOT wipe any referenced parquet files. pub async fn wipe(iox_object_store: &IoxObjectStore) -> Result<()> { - Ok(iox_object_store.wipe_catalog().await.context(WriteSnafu)?) + iox_object_store.wipe_catalog().await.context(WriteSnafu) } /// Create new catalog w/o any data. diff --git a/parquet_file/src/test_utils.rs b/parquet_file/src/test_utils.rs index 86489c68c5..fed0df2c93 100644 --- a/parquet_file/src/test_utils.rs +++ b/parquet_file/src/test_utils.rs @@ -76,7 +76,7 @@ pub async fn load_parquet_from_store_for_chunk( store: Arc<IoxObjectStore>, ) -> Result<Vec<u8>> { let path = chunk.path(); - Ok(load_parquet_from_store_for_path(path, store).await?) + load_parquet_from_store_for_path(path, store).await } pub async fn load_parquet_from_store_for_path( @@ -97,7 +97,7 @@ pub async fn load_parquet_from_store_for_path( fn create_column_tag( name: &str, data: Vec<Vec<Option<&str>>>, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -140,7 +140,7 @@ fn create_column_tag( fn create_columns_tag( column_prefix: &str, test_size: TestSize, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -184,7 +184,7 @@ fn create_columns_tag( fn create_column_field_string( name: &str, data: Vec<Vec<Option<&str>>>, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -215,7 +215,7 @@ fn create_column_field_string( fn create_columns_field_string( column_prefix: &str, test_size: TestSize, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -258,7 +258,7 @@ fn create_columns_field_string( fn create_column_field_i64( name: &str, data: Vec<Vec<Option<i64>>>, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -275,7 +275,7 @@ fn create_column_field_i64( fn create_columns_field_i64( column_prefix: &str, test_size: TestSize, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -319,7 +319,7 @@ fn create_columns_field_i64( fn create_column_field_u64( name: &str, data: Vec<Vec<Option<u64>>>, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -336,7 +336,7 @@ fn create_column_field_u64( fn create_columns_field_u64( column_prefix: &str, test_size: TestSize, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -379,7 +379,7 @@ fn create_columns_field_u64( fn create_column_field_f64( name: &str, data: Vec<Vec<Option<f64>>>, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -425,7 +425,7 @@ fn create_column_field_f64( fn create_columns_field_f64( column_prefix: &str, test_size: TestSize, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -509,7 +509,7 @@ fn create_columns_field_f64( fn create_column_field_bool( name: &str, data: Vec<Vec<Option<bool>>>, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -526,7 +526,7 @@ fn create_column_field_bool( fn create_columns_field_bool( column_prefix: &str, test_size: TestSize, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { @@ -562,7 +562,7 @@ fn create_columns_field_bool( fn create_column_field_generic<A, T, F>( name: &str, data: Vec<Vec<Option<T>>>, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, f: F, @@ -611,7 +611,7 @@ fn create_column_field_generic<A, T, F>( fn create_column_timestamp( data: Vec<Vec<i64>>, - arrow_cols: &mut Vec<Vec<(String, ArrayRef, bool)>>, + arrow_cols: &mut [Vec<(String, ArrayRef, bool)>], summaries: &mut Vec<ColumnSummary>, schema_builder: &mut SchemaBuilder, ) { diff --git a/server/src/lib.rs b/server/src/lib.rs index 089330471b..a717f52915 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -875,10 +875,10 @@ impl Server { let database = self.database(&db_name)?; // attempt to save provided rules in the current state - Ok(database + database .update_provided_rules(rules) .await - .context(CanNotUpdateRulesSnafu { db_name })?) + .context(CanNotUpdateRulesSnafu { db_name }) } /// Closes a chunk and starts moving its data to the read buffer, as a diff --git a/sqlx-hotswap-pool/src/lib.rs b/sqlx-hotswap-pool/src/lib.rs index d8155b84c2..9824c27efc 100644 --- a/sqlx-hotswap-pool/src/lib.rs +++ b/sqlx-hotswap-pool/src/lib.rs @@ -197,7 +197,7 @@ mod tests { }; let dsn = std::env::var("DATABASE_URL").unwrap(); let captured_schema_name = schema_name.clone(); - Ok(PgPoolOptions::new() + PgPoolOptions::new() .min_connections(1) .max_connections(5) .connect_timeout(Duration::from_secs(2)) @@ -222,7 +222,7 @@ mod tests { }) }) .connect(&dsn) - .await?) + .await } // The goal of this test is to verify that the hotswap pool can indeed replace