mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
chore: enable clippy::trivially_copy_pass_by_ref lint and address it (#6724)
This commit is contained in:
@ -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 ")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user