Skip to content

Commit

Permalink
chore: clear clippy warning
Browse files Browse the repository at this point in the history
  • Loading branch information
c-git committed Sep 11, 2024
1 parent 8952b35 commit 4b6ad38
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/app/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mod data_iter;
pub mod filter;

type LogRowIdxFieldName<'a> = Option<&'a String>;
type RowSlice<'a> = &'a [(String, String)];

#[derive(serde::Deserialize, serde::Serialize, Default, Debug, PartialEq, Eq)]
#[serde(default)]
Expand Down Expand Up @@ -69,7 +70,7 @@ impl LogRow {
}
}

pub fn as_slice(&mut self, common_fields: &BTreeSet<String>) -> &[(String, String)] {
pub fn as_slice(&mut self, common_fields: &BTreeSet<String>) -> RowSlice<'_> {
self.ensure_cache_is_populated(common_fields);

&self
Expand Down Expand Up @@ -160,7 +161,7 @@ impl Data {
pub fn selected_row_data_as_slice(
&mut self,
common_fields: &BTreeSet<String>,
) -> Option<&[(String, String)]> {
) -> Option<RowSlice<'_>> {
let selected_row_index = self.selected_row?;
let real_index = self.get_real_index(selected_row_index);
Some(self.rows[real_index].as_slice(common_fields))
Expand All @@ -169,7 +170,7 @@ impl Data {
pub fn selected_row_data_as_slice_with_filter_matching_fields(
&mut self,
common_fields: &BTreeSet<String>,
) -> Option<(&[(String, String)], Vec<usize>)> {
) -> Option<(RowSlice<'_>, Vec<usize>)> {
// Collect other needed info before taking mutable borrow to appease the borrow checker (couldn't find another readable way)
let is_filtered = self.is_filtered();
let filter = if is_filtered {
Expand Down Expand Up @@ -287,10 +288,7 @@ impl Data {
}

/// If the slice of fields and values matches the filter then the indices of the fields that match are returned or None if it does not match
fn matching_fields(
fields_and_values: &[(String, String)],
filter: &FilterConfig,
) -> Option<Vec<usize>> {
fn matching_fields(fields_and_values: RowSlice<'_>, filter: &FilterConfig) -> Option<Vec<usize>> {
let FilterConfig {
search_key,
filter_on,
Expand Down

0 comments on commit 4b6ad38

Please sign in to comment.