chore: enable clippy::trivially_copy_pass_by_ref lint and address it (#6724)

This commit is contained in:
Sanchith Hegde
2024-12-05 20:11:40 +05:30
committed by GitHub
parent e5dde6acc0
commit d17d2fe075
154 changed files with 423 additions and 429 deletions

View File

@ -379,7 +379,7 @@ impl Default for Filter {
impl<T: AnalyticsDataSource> ToSql<T> for Filter {
fn to_sql(&self, table_engine: &TableEngine) -> error_stack::Result<String, ParsingError> {
Ok(match self {
Self::Plain(l, op, r) => filter_type_to_sql(l, op, r),
Self::Plain(l, op, r) => filter_type_to_sql(l, *op, r),
Self::NestedFilter(operator, filters) => {
format!(
"( {} )",
@ -536,7 +536,7 @@ pub enum FilterTypes {
IsNotNull,
}
pub fn filter_type_to_sql(l: &String, op: &FilterTypes, r: &String) -> String {
pub fn filter_type_to_sql(l: &str, op: FilterTypes, r: &str) -> String {
match op {
FilterTypes::EqualBool => format!("{l} = {r}"),
FilterTypes::Equal => format!("{l} = '{r}'"),
@ -743,7 +743,7 @@ where
Ok(())
}
pub fn add_granularity_in_mins(&mut self, granularity: &Granularity) -> QueryResult<()> {
pub fn add_granularity_in_mins(&mut self, granularity: Granularity) -> QueryResult<()> {
let interval = match granularity {
Granularity::OneMin => "1",
Granularity::FiveMin => "5",
@ -814,7 +814,7 @@ where
pub fn get_filter_type_clause(&self) -> Option<String> {
self.having.as_ref().map(|vec| {
vec.iter()
.map(|(l, op, r)| filter_type_to_sql(l, op, r))
.map(|(l, op, r)| filter_type_to_sql(l, *op, r))
.collect::<Vec<String>>()
.join(" AND ")
})