From 72aab99951ce12a2b6f6618a226ab51abcb8bc58 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Thu, 15 Dec 2022 16:16:57 -0500 Subject: [PATCH] fix: Remove needless borrow. Thanks clippy! --- arrow_util/src/display.rs | 2 +- influxdb2_client/src/api/buckets.rs | 2 +- influxdb2_client/src/api/health.rs | 2 +- influxdb2_client/src/api/label.rs | 16 ++++++++-------- influxdb2_client/src/api/query.rs | 18 +++++++++--------- influxdb2_client/src/api/ready.rs | 2 +- influxdb2_client/src/api/setup.rs | 10 +++++----- influxdb2_client/src/api/write.rs | 2 +- iox_catalog/src/postgres.rs | 2 +- parquet_file/src/metadata.rs | 2 +- query_tests/src/runner.rs | 2 +- test_helpers_end_to_end/src/config.rs | 6 +++--- wal/src/lib.rs | 2 +- 13 files changed, 34 insertions(+), 34 deletions(-) diff --git a/arrow_util/src/display.rs b/arrow_util/src/display.rs index 868dc6ad22..6480e37ed3 100644 --- a/arrow_util/src/display.rs +++ b/arrow_util/src/display.rs @@ -100,7 +100,7 @@ fn create_table(results: &[RecordBatch]) -> Result { let mut cells = Vec::new(); for col in 0..batch.num_columns() { let column = batch.column(col); - cells.push(Cell::new(&array_value_to_string(column, row)?)); + cells.push(Cell::new(array_value_to_string(column, row)?)); } table.add_row(cells); } diff --git a/influxdb2_client/src/api/buckets.rs b/influxdb2_client/src/api/buckets.rs index 37f812a610..4f091973c6 100644 --- a/influxdb2_client/src/api/buckets.rs +++ b/influxdb2_client/src/api/buckets.rs @@ -58,7 +58,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client .create_bucket(Some(PostBucketRequest::new(org_id, bucket))) diff --git a/influxdb2_client/src/api/health.rs b/influxdb2_client/src/api/health.rs index 4fbb3adb9c..82b241370d 100644 --- a/influxdb2_client/src/api/health.rs +++ b/influxdb2_client/src/api/health.rs @@ -43,7 +43,7 @@ mod tests { async fn health() { let mock_server = mock("GET", "/health").create(); - let client = Client::new(&mockito::server_url(), ""); + let client = Client::new(mockito::server_url(), ""); let _result = client.health().await; diff --git a/influxdb2_client/src/api/label.rs b/influxdb2_client/src/api/label.rs index bb98256caa..282beb3077 100644 --- a/influxdb2_client/src/api/label.rs +++ b/influxdb2_client/src/api/label.rs @@ -151,7 +151,7 @@ mod tests { .match_header("Authorization", format!("Token {}", token).as_str()) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.labels().await; @@ -167,7 +167,7 @@ mod tests { .match_header("Authorization", format!("Token {}", token).as_str()) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.labels_by_org(org_id).await; @@ -183,7 +183,7 @@ mod tests { .match_header("Authorization", format!("Token {}", token).as_str()) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.find_label(label_id).await; @@ -210,7 +210,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.create_label(org_id, name, Some(properties)).await; @@ -229,7 +229,7 @@ mod tests { .match_body(format!(r#"{{"orgID":"{}","name":"{}"}}"#, org_id, name).as_str()) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.create_label(org_id, name, None).await; @@ -256,7 +256,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client .update_label(Some(name.to_string()), Some(properties), label_id) @@ -276,7 +276,7 @@ mod tests { .match_body("{}") .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.update_label(None, None, label_id).await; @@ -292,7 +292,7 @@ mod tests { .match_header("Authorization", format!("Token {}", token).as_str()) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.delete_label(label_id).await; diff --git a/influxdb2_client/src/api/query.rs b/influxdb2_client/src/api/query.rs index ff02553009..a727a87473 100644 --- a/influxdb2_client/src/api/query.rs +++ b/influxdb2_client/src/api/query.rs @@ -158,7 +158,7 @@ mod tests { .match_header("Authorization", format!("Token {}", token).as_str()) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.query_suggestions().await; @@ -181,7 +181,7 @@ mod tests { .match_header("Authorization", format!("Token {}", token).as_str()) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.query_suggestions_name(suggestion_name).await; @@ -205,7 +205,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.query_raw(org, query).await; @@ -230,7 +230,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.query_raw(org, None).await; @@ -251,7 +251,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.query_analyze(query).await; @@ -272,7 +272,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.query_analyze(query).await; @@ -294,7 +294,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.query_ast(language_request).await; @@ -315,7 +315,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client.query_ast(language_request).await; @@ -340,7 +340,7 @@ mod tests { .with_body("") .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let result = client.query_raw(org, query).await.expect("request success"); assert_eq!(result, ""); diff --git a/influxdb2_client/src/api/ready.rs b/influxdb2_client/src/api/ready.rs index 40b723277e..6067fd584b 100644 --- a/influxdb2_client/src/api/ready.rs +++ b/influxdb2_client/src/api/ready.rs @@ -37,7 +37,7 @@ mod tests { async fn ready() { let mock_server = mock("GET", "/ready").create(); - let client = Client::new(&mockito::server_url(), ""); + let client = Client::new(mockito::server_url(), ""); let _result = client.ready().await; diff --git a/influxdb2_client/src/api/setup.rs b/influxdb2_client/src/api/setup.rs index 4b04cae280..e28649abda 100644 --- a/influxdb2_client/src/api/setup.rs +++ b/influxdb2_client/src/api/setup.rs @@ -123,7 +123,7 @@ mod tests { async fn is_onboarding_allowed() { let mock_server = mock("GET", "/api/v2/setup").create(); - let client = Client::new(&mockito::server_url(), ""); + let client = Client::new(mockito::server_url(), ""); let _result = client.is_onboarding_allowed().await; @@ -149,7 +149,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client .onboarding( @@ -185,7 +185,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client .post_setup_user( @@ -218,7 +218,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), ""); + let client = Client::new(mockito::server_url(), ""); let _result = client .onboarding(username, org, bucket, None, None, None) @@ -246,7 +246,7 @@ mod tests { ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let _result = client .post_setup_user(username, org, bucket, None, None, None) diff --git a/influxdb2_client/src/api/write.rs b/influxdb2_client/src/api/write.rs index cb9c3561ea..4b2c42ce0a 100644 --- a/influxdb2_client/src/api/write.rs +++ b/influxdb2_client/src/api/write.rs @@ -85,7 +85,7 @@ cpu,host=server01,region=us-west usage=0.87 ) .create(); - let client = Client::new(&mockito::server_url(), token); + let client = Client::new(mockito::server_url(), token); let points = vec![ DataPoint::builder("cpu") diff --git a/iox_catalog/src/postgres.rs b/iox_catalog/src/postgres.rs index 1400f2c4cd..9a95c8f4be 100644 --- a/iox_catalog/src/postgres.rs +++ b/iox_catalog/src/postgres.rs @@ -401,7 +401,7 @@ async fn new_pool( options: &PostgresConnectionOptions, ) -> Result, sqlx::Error> { let parsed_dsn = match get_dsn_file_path(&options.dsn) { - Some(filename) => std::fs::read_to_string(&filename)?, + Some(filename) => std::fs::read_to_string(filename)?, None => options.dsn.clone(), }; let pool = HotSwapPool::new(new_raw_pool(options, &parsed_dsn).await?); diff --git a/parquet_file/src/metadata.rs b/parquet_file/src/metadata.rs index f0a6cccac0..a2875f697d 100644 --- a/parquet_file/src/metadata.rs +++ b/parquet_file/src/metadata.rs @@ -301,7 +301,7 @@ pub struct IoxMetadata { impl IoxMetadata { /// Convert to base64 encoded protobuf format pub fn to_base64(&self) -> std::result::Result { - Ok(base64::encode(&self.to_protobuf()?)) + Ok(base64::encode(self.to_protobuf()?)) } /// Read from base64 encoded protobuf format diff --git a/query_tests/src/runner.rs b/query_tests/src/runner.rs index 648ff29073..c85429ed9c 100644 --- a/query_tests/src/runner.rs +++ b/query_tests/src/runner.rs @@ -653,7 +653,7 @@ SELECT * from cpu ORDER BY time DESC; std::fs::create_dir(&in_dir).expect("create in-dir"); let out_dir = dir.path().join("out"); - std::fs::create_dir(&out_dir).expect("create out-dir"); + std::fs::create_dir(out_dir).expect("create out-dir"); let mut file = in_dir; file.push("foo.sql"); diff --git a/test_helpers_end_to_end/src/config.rs b/test_helpers_end_to_end/src/config.rs index 1586826c36..8c8e907cec 100644 --- a/test_helpers_end_to_end/src/config.rs +++ b/test_helpers_end_to_end/src/config.rs @@ -280,7 +280,7 @@ impl TestConfig { "INFLUXDB_IOX_WRITE_BUFFER_AUTO_CREATE_TOPICS", n_shards.to_string(), ) - .with_env("INFLUXDB_IOX_WRITE_BUFFER_ADDR", &write_buffer_string) + .with_env("INFLUXDB_IOX_WRITE_BUFFER_ADDR", write_buffer_string) } /// Configures this TestConfig to use the same write buffer as other @@ -307,7 +307,7 @@ impl TestConfig { let wal_string = tmpdir.path().display().to_string(); self.wal_dir = Some(Arc::new(tmpdir)); - self.with_env("INFLUXDB_IOX_WAL_DIRECTORY", &wal_string) + self.with_env("INFLUXDB_IOX_WAL_DIRECTORY", wal_string) } /// Configures a new object store @@ -317,7 +317,7 @@ impl TestConfig { let object_store_string = tmpdir.path().display().to_string(); self.object_store_dir = Some(Arc::new(tmpdir)); self.with_env("INFLUXDB_IOX_OBJECT_STORE", "file") - .with_env("INFLUXDB_IOX_DB_DIR", &object_store_string) + .with_env("INFLUXDB_IOX_DB_DIR", object_store_string) } /// Configures this TestConfig to use the same object store as other diff --git a/wal/src/lib.rs b/wal/src/lib.rs index 9d739f5ad9..56eddc56fb 100644 --- a/wal/src/lib.rs +++ b/wal/src/lib.rs @@ -296,7 +296,7 @@ impl Wal { /// Open a reader to a closed segment pub fn reader_for_segment(&self, id: SegmentId) -> Result { let path = build_segment_path(&self.root, id); - ClosedSegmentFileReader::from_path(&path) + ClosedSegmentFileReader::from_path(path) } /// Writes one [`SequencedWalOp`] to the buffer and returns a watch channel for when the buffer