Skip to content

Commit 0353dc4

Browse files
author
Devdutt Shenoi
authored
ci: applying clippy suggestions (#1014)
Fixes ci issues pointed out in #1013. This is pertaining to lints which have been introduced in the latest version of clippy.
1 parent f08acf4 commit 0353dc4

File tree

4 files changed

+44
-46
lines changed

4 files changed

+44
-46
lines changed

src/alerts/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub struct Message {
136136
impl Message {
137137
// checks if message (with a column name) is valid (i.e. the column name is present in the schema)
138138
pub fn valid(&self, schema: &Schema, column: &str) -> bool {
139-
return get_field(&schema.fields, column).is_some();
139+
get_field(&schema.fields, column).is_some()
140140
}
141141

142142
pub fn extract_column_names(&self) -> Vec<&str> {

src/handlers/http/modal/utils/logstream_utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ async fn update_stream(
148148
return Ok(req.headers().clone());
149149
}
150150
validate_and_update_custom_partition(stream_name, custom_partition).await?;
151-
return Ok(req.headers().clone());
151+
152+
Ok(req.headers().clone())
152153
}
153154

154155
async fn validate_and_update_custom_partition(

src/handlers/http/otel/opentelemetry.proto.resource.v1.rs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,22 @@
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*
1717
*/
18-
// This file was generated by protoc-gen-rust-protobuf. The file was edited after the generation.
19-
// All the repeated fields were changed to Option<Vec<T>>
18+
// This file was generated by protoc-gen-rust-protobuf. The file was edited after the generation.
19+
// All the repeated fields were changed to Option<Vec<T>>
2020

21-
use crate::handlers::http::otel::proto::common::v1::KeyValue;
22-
use serde::{Deserialize, Serialize};
23-
24-
#[derive(Serialize, Deserialize, Debug)]
25-
/// Resource information.
26-
pub struct Resource {
27-
/// Set of attributes that describe the resource.
28-
/// Attribute keys MUST be unique (it is not allowed to have more than one
29-
/// attribute with the same key).
30-
#[serde(rename = "attributes")]
31-
pub attributes: Option<Vec<KeyValue>>,
32-
/// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
33-
/// no attributes were dropped.
34-
35-
#[serde(rename = "droppedAttributesCount")]
36-
pub dropped_attributes_count: Option<u32>,
37-
}
38-
21+
use crate::handlers::http::otel::proto::common::v1::KeyValue;
22+
use serde::{Deserialize, Serialize};
23+
24+
#[derive(Serialize, Deserialize, Debug)]
25+
/// Resource information.
26+
pub struct Resource {
27+
/// Set of attributes that describe the resource.
28+
/// Attribute keys MUST be unique (it is not allowed to have more than one
29+
/// attribute with the same key).
30+
#[serde(rename = "attributes")]
31+
pub attributes: Option<Vec<KeyValue>>,
32+
/// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
33+
/// no attributes were dropped.
34+
#[serde(rename = "droppedAttributesCount")]
35+
pub dropped_attributes_count: Option<u32>,
36+
}

src/utils/arrow/mod.rs

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,29 @@
1717
*
1818
*/
1919

20+
//! example function for concat recordbatch(may not work)
21+
//! ```rust
22+
//! # use arrow::record_batch::RecordBatch;
23+
//! # use arrow::error::Result;
24+
//!
25+
//! fn concat_batches(batch1: RecordBatch, batch2: RecordBatch) -> Result<RecordBatch> {
26+
//! let schema = batch1.schema();
27+
//! let columns = schema
28+
//! .fields()
29+
//! .iter()
30+
//! .enumerate()
31+
//! .map(|(i, _)| -> Result<_> {
32+
//! let array1 = batch1.column(i);
33+
//! let array2 = batch2.column(i);
34+
//! let array = arrow::compute::concat(&[array1.as_ref(), array2.as_ref()])?;
35+
//! Ok(array)
36+
//! })
37+
//! .collect::<Result<Vec<_>>>()?;
38+
//!
39+
//! RecordBatch::try_new(schema.clone(), columns)
40+
//! }
41+
//! ```
42+
2043
use std::sync::Arc;
2144

2245
use arrow_array::{Array, RecordBatch};
@@ -33,30 +56,6 @@ pub use batch_adapter::adapt_batch;
3356
pub use merged_reader::MergedRecordReader;
3457
use serde_json::{Map, Value};
3558

36-
/// example function for concat recordbatch(may not work)
37-
/// ```rust
38-
/// # use arrow::record_batch::RecordBatch;
39-
/// # use arrow::error::Result;
40-
///
41-
/// fn concat_batches(batch1: RecordBatch, batch2: RecordBatch) -> Result<RecordBatch> {
42-
/// let schema = batch1.schema();
43-
/// let columns = schema
44-
/// .fields()
45-
/// .iter()
46-
/// .enumerate()
47-
/// .map(|(i, _)| -> Result<_> {
48-
/// let array1 = batch1.column(i);
49-
/// let array2 = batch2.column(i);
50-
/// let array = arrow::compute::concat(&[array1.as_ref(), array2.as_ref()])?;
51-
/// Ok(array)
52-
/// })
53-
/// .collect::<Result<Vec<_>>>()?;
54-
///
55-
/// RecordBatch::try_new(schema.clone(), columns)
56-
/// }
57-
/// ```
58-
///
59-
6059
/// Replaces columns in a record batch with new arrays.
6160
///
6261
/// # Arguments

0 commit comments

Comments
 (0)