Skip to content

Commit 2b5dc35

Browse files
fixed clippy
1 parent 2363006 commit 2b5dc35

2 files changed

Lines changed: 22 additions & 23 deletions

File tree

‎asap-planner-rs/src/lib.rs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@ impl PlannerOutput {
140140
for key in
141141
["read_count_threshold", "num_aggregates_to_retain"]
142142
{
143-
if let Some(v) = agg.get(key) {
144-
if let YamlValue::Number(n) = v {
145-
return n.as_u64();
146-
}
143+
if let Some(YamlValue::Number(n)) = agg.get(key) {
144+
return n.as_u64();
147145
}
148146
}
149147
}

‎asap-planner-rs/src/planner/logics.rs‎

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,30 @@ pub fn get_cleanup_param(
250250
Ok(result)
251251
}
252252

253+
pub fn set_subpopulation_labels(
254+
statistic: Statistic,
255+
aggregation_type: &str,
256+
subpopulation_labels: &KeyByLabelNames,
257+
rollup_labels: &mut KeyByLabelNames,
258+
grouping_labels: &mut KeyByLabelNames,
259+
aggregated_labels: &mut KeyByLabelNames,
260+
) {
261+
// rollup is set by caller before calling this function
262+
let _ = rollup_labels; // not modified here
263+
if does_precompute_operator_support_subpopulations(statistic, aggregation_type) {
264+
*grouping_labels = KeyByLabelNames::empty();
265+
*aggregated_labels = subpopulation_labels.clone();
266+
} else {
267+
*grouping_labels = subpopulation_labels.clone();
268+
*aggregated_labels = KeyByLabelNames::empty();
269+
}
270+
}
271+
253272
#[cfg(test)]
254273
mod tests {
255274
use super::*;
256275
use crate::planner::patterns::build_patterns;
276+
257277
use promql_utilities::ast_matching::PromQLMatchResult;
258278
use promql_utilities::query_logics::enums::QueryPatternType;
259279

@@ -381,22 +401,3 @@ mod tests {
381401
assert!(result.is_err());
382402
}
383403
}
384-
385-
pub fn set_subpopulation_labels(
386-
statistic: Statistic,
387-
aggregation_type: &str,
388-
subpopulation_labels: &KeyByLabelNames,
389-
rollup_labels: &mut KeyByLabelNames,
390-
grouping_labels: &mut KeyByLabelNames,
391-
aggregated_labels: &mut KeyByLabelNames,
392-
) {
393-
// rollup is set by caller before calling this function
394-
let _ = rollup_labels; // not modified here
395-
if does_precompute_operator_support_subpopulations(statistic, aggregation_type) {
396-
*grouping_labels = KeyByLabelNames::empty();
397-
*aggregated_labels = subpopulation_labels.clone();
398-
} else {
399-
*grouping_labels = subpopulation_labels.clone();
400-
*aggregated_labels = KeyByLabelNames::empty();
401-
}
402-
}

0 commit comments

Comments
 (0)