Skip to content

Commit d0e43e5

Browse files
committed
fix(enterprise): resolve clippy warnings in license commands
- Use if-let chains with && syntax for collapsible if statements - Replace manual range checks with RangeInclusive::contains() - Ensures clean CI pipeline for PR #308
1 parent dd0e76f commit d0e43e5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

crates/redisctl/src/commands/enterprise/license.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -330,19 +330,19 @@ async fn handle_license_usage(
330330

331331
// Helper functions
332332
pub fn calculate_days_remaining(expiration_date: Option<&str>) -> i64 {
333-
if let Some(date_str) = expiration_date {
334-
if let Ok(exp_date) = chrono::NaiveDate::parse_from_str(date_str, "%Y-%m-%d") {
335-
let today = chrono::Local::now().naive_local().date();
336-
let duration = exp_date.signed_duration_since(today);
337-
return duration.num_days();
338-
}
333+
if let Some(date_str) = expiration_date
334+
&& let Ok(exp_date) = chrono::NaiveDate::parse_from_str(date_str, "%Y-%m-%d")
335+
{
336+
let today = chrono::Local::now().naive_local().date();
337+
let duration = exp_date.signed_duration_since(today);
338+
return duration.num_days();
339339
}
340340
-1
341341
}
342342

343343
pub fn should_warn_expiry(expiration_date: Option<&str>) -> bool {
344344
let days = calculate_days_remaining(expiration_date);
345-
days >= 0 && days <= 30
345+
(0..=30).contains(&days)
346346
}
347347

348348
pub fn calculate_available(limit: Option<i64>, used: Option<i64>) -> i64 {

crates/redisctl/src/commands/enterprise/license_workflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ async fn handle_license_audit(
116116
.unwrap_or("unknown");
117117
let days_remaining =
118118
super::license::calculate_days_remaining(Some(expiration_date));
119-
let is_expiring = days_remaining >= 0 && days_remaining <= 30;
119+
let is_expiring = (0..=30).contains(&days_remaining);
120120

121121
// Apply filters
122122
if expired_only && !expired {

0 commit comments

Comments
 (0)