Skip to content

Commit

Permalink
ci: applying clippy suggestions (#1014)
Browse files Browse the repository at this point in the history
Fixes ci issues pointed out in #1013. This is pertaining 
to lints which have been introduced in the latest version 
of clippy.
  • Loading branch information
de-sh authored Dec 2, 2024
1 parent f08acf4 commit 0353dc4
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/alerts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub struct Message {
impl Message {
// checks if message (with a column name) is valid (i.e. the column name is present in the schema)
pub fn valid(&self, schema: &Schema, column: &str) -> bool {
return get_field(&schema.fields, column).is_some();
get_field(&schema.fields, column).is_some()
}

pub fn extract_column_names(&self) -> Vec<&str> {
Expand Down
3 changes: 2 additions & 1 deletion src/handlers/http/modal/utils/logstream_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ async fn update_stream(
return Ok(req.headers().clone());
}
validate_and_update_custom_partition(stream_name, custom_partition).await?;
return Ok(req.headers().clone());

Ok(req.headers().clone())
}

async fn validate_and_update_custom_partition(
Expand Down
38 changes: 18 additions & 20 deletions src/handlers/http/otel/opentelemetry.proto.resource.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// This file was generated by protoc-gen-rust-protobuf. The file was edited after the generation.
// All the repeated fields were changed to Option<Vec<T>>
// This file was generated by protoc-gen-rust-protobuf. The file was edited after the generation.
// All the repeated fields were changed to Option<Vec<T>>

use crate::handlers::http::otel::proto::common::v1::KeyValue;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
/// Resource information.
pub struct Resource {
/// Set of attributes that describe the resource.
/// Attribute keys MUST be unique (it is not allowed to have more than one
/// attribute with the same key).
#[serde(rename = "attributes")]
pub attributes: Option<Vec<KeyValue>>,
/// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
/// no attributes were dropped.
#[serde(rename = "droppedAttributesCount")]
pub dropped_attributes_count: Option<u32>,
}

use crate::handlers::http::otel::proto::common::v1::KeyValue;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
/// Resource information.
pub struct Resource {
/// Set of attributes that describe the resource.
/// Attribute keys MUST be unique (it is not allowed to have more than one
/// attribute with the same key).
#[serde(rename = "attributes")]
pub attributes: Option<Vec<KeyValue>>,
/// dropped_attributes_count is the number of dropped attributes. If the value is 0, then
/// no attributes were dropped.
#[serde(rename = "droppedAttributesCount")]
pub dropped_attributes_count: Option<u32>,
}
47 changes: 23 additions & 24 deletions src/utils/arrow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,29 @@
*
*/

//! example function for concat recordbatch(may not work)
//! ```rust
//! # use arrow::record_batch::RecordBatch;
//! # use arrow::error::Result;
//!
//! fn concat_batches(batch1: RecordBatch, batch2: RecordBatch) -> Result<RecordBatch> {
//! let schema = batch1.schema();
//! let columns = schema
//! .fields()
//! .iter()
//! .enumerate()
//! .map(|(i, _)| -> Result<_> {
//! let array1 = batch1.column(i);
//! let array2 = batch2.column(i);
//! let array = arrow::compute::concat(&[array1.as_ref(), array2.as_ref()])?;
//! Ok(array)
//! })
//! .collect::<Result<Vec<_>>>()?;
//!
//! RecordBatch::try_new(schema.clone(), columns)
//! }
//! ```
use std::sync::Arc;

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

/// example function for concat recordbatch(may not work)
/// ```rust
/// # use arrow::record_batch::RecordBatch;
/// # use arrow::error::Result;
///
/// fn concat_batches(batch1: RecordBatch, batch2: RecordBatch) -> Result<RecordBatch> {
/// let schema = batch1.schema();
/// let columns = schema
/// .fields()
/// .iter()
/// .enumerate()
/// .map(|(i, _)| -> Result<_> {
/// let array1 = batch1.column(i);
/// let array2 = batch2.column(i);
/// let array = arrow::compute::concat(&[array1.as_ref(), array2.as_ref()])?;
/// Ok(array)
/// })
/// .collect::<Result<Vec<_>>>()?;
///
/// RecordBatch::try_new(schema.clone(), columns)
/// }
/// ```
///
/// Replaces columns in a record batch with new arrays.
///
/// # Arguments
Expand Down

0 comments on commit 0353dc4

Please sign in to comment.