Skip to content

Commit

Permalink
chore: enable clippy::trivially_copy_pass_by_ref lint and address it (
Browse files Browse the repository at this point in the history
  • Loading branch information
SanchithHegde authored Dec 5, 2024
1 parent e5dde6a commit d17d2fe
Show file tree
Hide file tree
Showing 154 changed files with 423 additions and 429 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ panicking_unwrap = "warn"
print_stderr = "warn"
print_stdout = "warn"
todo = "warn"
trivially_copy_pass_by_ref = "warn"
unimplemented = "warn"
unnecessary_self_imports = "warn"
unreachable = "warn"
Expand Down
2 changes: 1 addition & 1 deletion crates/analytics/src/api_event/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub async fn get_api_event_metrics(
&req.group_by_names.clone(),
&merchant_id_scoped,
&req.filters,
&req.time_series.map(|t| t.granularity),
req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
Expand Down
4 changes: 2 additions & 2 deletions crates/analytics/src/api_event/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ where
dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>>;
Expand All @@ -66,7 +66,7 @@ where
dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
Expand Down
4 changes: 2 additions & 2 deletions crates/analytics/src/api_event/metrics/api_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
_dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
Expand Down Expand Up @@ -62,7 +62,7 @@ where
alias: Some("end_bucket"),
})
.switch()?;
if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
Expand Down
4 changes: 2 additions & 2 deletions crates/analytics/src/api_event/metrics/latency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ where
_dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
Expand Down Expand Up @@ -67,7 +67,7 @@ where
alias: Some("end_bucket"),
})
.switch()?;
if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
Expand Down
4 changes: 2 additions & 2 deletions crates/analytics/src/api_event/metrics/status_code_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
_dimensions: &[ApiEventDimensions],
merchant_id: &common_utils::id_type::MerchantId,
filters: &ApiEventFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(ApiEventMetricsBucketIdentifier, ApiEventMetricRow)>> {
Expand Down Expand Up @@ -68,7 +68,7 @@ where
alias: Some("end_bucket"),
})
.switch()?;
if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.attach_printable("Error adding granularity")
Expand Down
2 changes: 1 addition & 1 deletion crates/analytics/src/auth_events/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub async fn get_metrics(
&metric_type,
&merchant_id_scoped,
&publishable_key_scoped,
&req.time_series.map(|t| t.granularity),
req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
Expand Down
4 changes: 2 additions & 2 deletions crates/analytics/src/auth_events/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ where
&self,
merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>>;
Expand All @@ -66,7 +66,7 @@ where
&self,
merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
&self,
_merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
Expand All @@ -45,7 +45,7 @@ where
})
.switch()?;

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
&self,
_merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
Expand All @@ -45,7 +45,7 @@ where
})
.switch()?;

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
&self,
merchant_id: &common_utils::id_type::MerchantId,
_publishable_key: &str,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
Expand All @@ -45,7 +45,7 @@ where
})
.switch()?;

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
&self,
_merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
Expand All @@ -45,7 +45,7 @@ where
})
.switch()?;

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
&self,
merchant_id: &common_utils::id_type::MerchantId,
_publishable_key: &str,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
Expand All @@ -45,7 +45,7 @@ where
})
.switch()?;

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
&self,
_merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
Expand All @@ -45,7 +45,7 @@ where
})
.switch()?;

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
&self,
merchant_id: &common_utils::id_type::MerchantId,
_publishable_key: &str,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
Expand All @@ -45,7 +45,7 @@ where
})
.switch()?;

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
&self,
_merchant_id: &common_utils::id_type::MerchantId,
publishable_key: &str,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(AuthEventMetricsBucketIdentifier, AuthEventMetricRow)>> {
Expand All @@ -45,7 +45,7 @@ where
})
.switch()?;

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
query_builder
.add_granularity_in_mins(granularity)
.switch()?;
Expand Down
2 changes: 1 addition & 1 deletion crates/analytics/src/disputes/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub async fn get_metrics(
&req.group_by_names.clone(),
&auth_scoped,
&req.filters,
&req.time_series.map(|t| t.granularity),
req.time_series.map(|t| t.granularity),
&req.time_range,
)
.await
Expand Down
4 changes: 2 additions & 2 deletions crates/analytics/src/disputes/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>;
Expand All @@ -73,7 +73,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
Expand Down Expand Up @@ -80,7 +80,7 @@ where
.add_group_by_clause("dispute_status")
.switch()?;

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
Expand Down Expand Up @@ -80,7 +80,7 @@ where
.add_group_by_clause("dispute_status")
.switch()?;

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
Expand Down Expand Up @@ -78,7 +78,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
Expand Down Expand Up @@ -78,7 +78,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
Expand Down Expand Up @@ -77,7 +77,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
dimensions: &[DisputeDimensions],
auth: &AuthInfo,
filters: &DisputeFilters,
granularity: &Option<Granularity>,
granularity: Option<Granularity>,
time_range: &TimeRange,
pool: &T,
) -> MetricsResult<HashSet<(DisputeMetricsBucketIdentifier, DisputeMetricRow)>>
Expand Down Expand Up @@ -77,7 +77,7 @@ where
query_builder.add_group_by_clause(dim).switch()?;
}

if let Some(granularity) = granularity.as_ref() {
if let Some(granularity) = granularity {
granularity
.set_group_by_clause(&mut query_builder)
.switch()?;
Expand Down
Loading

0 comments on commit d17d2fe

Please sign in to comment.