Skip to content

Commit 9b30159

Browse files
Your Nameclaude
andcommitted
fix(clippy): resolve manual_is_multiple_of and large_enum_variant warnings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent de4715b commit 9b30159

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

crates/ci-server/src/tools.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ fn secs_to_ymd_hms(secs: u64) -> (u64, u64, u64, u64, u64, u64) {
3636
fn days_to_ymd(mut days: u64) -> (u64, u64, u64) {
3737
let mut year = 1970u64;
3838
loop {
39-
let leap = (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
39+
let leap =
40+
(year.is_multiple_of(4) && !year.is_multiple_of(100)) || year.is_multiple_of(400);
4041
let days_in_year = if leap { 366 } else { 365 };
4142
if days < days_in_year {
4243
break;
4344
}
4445
days -= days_in_year;
4546
year += 1;
4647
}
47-
let leap = (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
48+
let leap =
49+
(year.is_multiple_of(4) && !year.is_multiple_of(100)) || year.is_multiple_of(400);
4850
let month_days: &[u64] = if leap {
4951
&[31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
5052
} else {
@@ -513,7 +515,7 @@ fn resolve_symbol_candidates(
513515
enum SymbolResolution {
514516
NotFound,
515517
Ambiguous(Vec<CandidateRow>),
516-
Found(CandidateRow),
518+
Found(Box<CandidateRow>),
517519
}
518520

519521
/// Resolve a bare symbol name (+ optional path) to exactly one row.
@@ -527,7 +529,7 @@ fn resolve_symbol(conn: &rusqlite::Connection, name: &str, path: Option<&str>) -
527529
if candidates.is_empty() {
528530
SymbolResolution::NotFound
529531
} else if candidates.len() == 1 {
530-
SymbolResolution::Found(candidates.remove(0))
532+
SymbolResolution::Found(Box::new(candidates.remove(0)))
531533
} else {
532534
SymbolResolution::Ambiguous(candidates)
533535
}
@@ -1667,6 +1669,7 @@ RULES: Never use native grep/read on project files. is_hub:true → extra cautio
16671669
SymbolResolution::NotFound => not_found_json(&p.symbol),
16681670
SymbolResolution::Ambiguous(candidates) => ambiguous_json(&candidates),
16691671
SymbolResolution::Found(c) => {
1672+
let c = *c;
16701673
self.track_symbol(&c.qualified_name);
16711674
self.track_file(&c.path);
16721675
let mut out = c.to_symbol_info();
@@ -1704,7 +1707,7 @@ RULES: Never use native grep/read on project files. is_hub:true → extra cautio
17041707
let c = match resolution {
17051708
SymbolResolution::NotFound => return not_found_json(&p.symbol),
17061709
SymbolResolution::Ambiguous(candidates) => return ambiguous_json(&candidates),
1707-
SymbolResolution::Found(c) => c,
1710+
SymbolResolution::Found(c) => *c,
17081711
};
17091712
self.track_symbol(&c.qualified_name);
17101713
self.track_file(&c.path);
@@ -1767,7 +1770,7 @@ RULES: Never use native grep/read on project files. is_hub:true → extra cautio
17671770
let c = match resolution {
17681771
SymbolResolution::NotFound => return not_found_json(&p.symbol),
17691772
SymbolResolution::Ambiguous(candidates) => return ambiguous_json(&candidates),
1770-
SymbolResolution::Found(c) => c,
1773+
SymbolResolution::Found(c) => *c,
17711774
};
17721775
self.track_symbol(&c.qualified_name);
17731776
self.track_file(&c.path);
@@ -1850,7 +1853,7 @@ RULES: Never use native grep/read on project files. is_hub:true → extra cautio
18501853
let c = match resolution {
18511854
SymbolResolution::NotFound => return not_found_json(&p.symbol),
18521855
SymbolResolution::Ambiguous(candidates) => return ambiguous_json(&candidates),
1853-
SymbolResolution::Found(c) => c,
1856+
SymbolResolution::Found(c) => *c,
18541857
};
18551858
self.track_symbol(&c.qualified_name);
18561859
self.track_file(&c.path);
@@ -1992,7 +1995,7 @@ RULES: Never use native grep/read on project files. is_hub:true → extra cautio
19921995
let from = match from {
19931996
SymbolResolution::NotFound => return not_found_json(&p.from_symbol),
19941997
SymbolResolution::Ambiguous(candidates) => return ambiguous_json(&candidates),
1995-
SymbolResolution::Found(c) => c,
1998+
SymbolResolution::Found(c) => *c,
19961999
};
19972000
self.track_symbol(&from.qualified_name);
19982001
self.track_file(&from.path);
@@ -2003,7 +2006,7 @@ RULES: Never use native grep/read on project files. is_hub:true → extra cautio
20032006
let to = match to {
20042007
SymbolResolution::NotFound => return not_found_json(&p.to_symbol),
20052008
SymbolResolution::Ambiguous(candidates) => return ambiguous_json(&candidates),
2006-
SymbolResolution::Found(c) => c,
2009+
SymbolResolution::Found(c) => *c,
20072010
};
20082011
self.track_symbol(&to.qualified_name);
20092012
self.track_file(&to.path);
@@ -2080,7 +2083,7 @@ RULES: Never use native grep/read on project files. is_hub:true → extra cautio
20802083
let c = match resolution {
20812084
SymbolResolution::NotFound => return not_found_json(&p.symbol),
20822085
SymbolResolution::Ambiguous(candidates) => return ambiguous_json(&candidates),
2083-
SymbolResolution::Found(c) => c,
2086+
SymbolResolution::Found(c) => *c,
20842087
};
20852088
self.track_symbol(&c.qualified_name);
20862089
self.track_file(&c.path);

0 commit comments

Comments
 (0)