Skip to content

Commit 5b8e88b

Browse files
committed
no-mistakes(lint): apply rustfmt and clippy is_multiple_of fixes
1 parent c1601cb commit 5b8e88b

2 files changed

Lines changed: 24 additions & 10 deletions

File tree

crates/codegraph-server/src/ai_query/engine.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,12 @@ impl QueryEngine {
401401
pos = end;
402402
chunks_done += 1;
403403

404-
if chunks_done % 10 == 0 && pos < total {
404+
if chunks_done.is_multiple_of(10) && pos < total {
405405
tracing::info!("[QueryEngine] Embedded {}/{} symbols", pos, total);
406406
}
407407

408408
// RAM backpressure: shed batch size under memory pressure.
409-
let pressured = chunks_done % EMBED_MEM_CHECK_CHUNKS == 0
409+
let pressured = chunks_done.is_multiple_of(EMBED_MEM_CHECK_CHUNKS)
410410
&& embed_memory_pressured(available_memory_mb());
411411
if pressured && chunk_size > 4 {
412412
chunk_size = (chunk_size / 2).max(4);
@@ -555,7 +555,7 @@ impl QueryEngine {
555555
pos = end;
556556
chunks_done += 1;
557557

558-
let pressured = chunks_done % EMBED_MEM_CHECK_CHUNKS == 0
558+
let pressured = chunks_done.is_multiple_of(EMBED_MEM_CHECK_CHUNKS)
559559
&& embed_memory_pressured(available_memory_mb());
560560
if pressured && chunk_size > 4 {
561561
chunk_size = (chunk_size / 2).max(4);
@@ -3991,7 +3991,10 @@ mod tests {
39913991

39923992
#[test]
39933993
fn split_identifier_words_handles_camel_and_snake() {
3994-
assert_eq!(split_identifier_words("authenticate_user"), "authenticate user");
3994+
assert_eq!(
3995+
split_identifier_words("authenticate_user"),
3996+
"authenticate user"
3997+
);
39953998
assert_eq!(split_identifier_words("getUserById"), "get user by id");
39963999
// The existing tokenizer keeps acronym+word runs joined (HTML|Parser is
39974000
// NOT split) and drops 1-char tokens — known limitations worth revisiting
@@ -4013,11 +4016,13 @@ mod tests {
40134016
// Enabled: split name words are front-loaded for the static embedder.
40144017
let with_split =
40154018
QueryEngine::build_embed_text(&node, 0, "getUserById", false, true, &graph);
4016-
assert!(with_split.starts_with("get user by id"), "got: {with_split}");
4019+
assert!(
4020+
with_split.starts_with("get user by id"),
4021+
"got: {with_split}"
4022+
);
40174023

40184024
// Disabled (default): original transformer-path text is unchanged.
4019-
let without =
4020-
QueryEngine::build_embed_text(&node, 0, "getUserById", false, false, &graph);
4025+
let without = QueryEngine::build_embed_text(&node, 0, "getUserById", false, false, &graph);
40214026
assert!(without.starts_with("getUserById"), "got: {without}");
40224027
assert!(!without.contains("get user by id"));
40234028
}

crates/codegraph-server/src/memory.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ pub struct MemoryManager {
248248
impl MemoryManager {
249249
/// Create a new MemoryManager
250250
pub fn new(extension_path: Option<PathBuf>) -> Self {
251-
Self::with_model(extension_path, codegraph_memory::EmbeddingBackend::default())
251+
Self::with_model(
252+
extension_path,
253+
codegraph_memory::EmbeddingBackend::default(),
254+
)
252255
}
253256

254257
/// Create a new MemoryManager with a specific embedding backend
@@ -681,7 +684,10 @@ mod tests {
681684

682685
#[test]
683686
fn gate_loads_when_ample_memory() {
684-
assert_eq!(evaluate_memory_gate(8_000_000_000, MIN, false), MemoryGate::Load);
687+
assert_eq!(
688+
evaluate_memory_gate(8_000_000_000, MIN, false),
689+
MemoryGate::Load
690+
);
685691
}
686692

687693
#[test]
@@ -713,7 +719,10 @@ mod tests {
713719
// CODEGRAPH_SKIP_MEMORY_CHECK=1 overrides even a genuine low reading.
714720
assert_eq!(evaluate_memory_gate(0, MIN, true), MemoryGate::Load);
715721
assert_eq!(evaluate_memory_gate(1, MIN, true), MemoryGate::Load);
716-
assert_eq!(evaluate_memory_gate(500_000_000, MIN, true), MemoryGate::Load);
722+
assert_eq!(
723+
evaluate_memory_gate(500_000_000, MIN, true),
724+
MemoryGate::Load
725+
);
717726
}
718727

719728
#[test]

0 commit comments

Comments
 (0)