Skip to content

Commit 210073c

Browse files
mivertowskiclaude
andcommitted
Fix clippy warnings and formatting issues for CI
- Fix unused variables in ringkernel-ir tests (prefix with _) - Replace approx PI constants (3.14) with non-PI values (3.125) - Fix let_unit_value warnings by using assert_eq! - Replace vec! with array literal for fixed-size buffer - Remove needless borrow in Arc::ptr_eq call - Use is_empty() instead of len() > 0 - Use iterator pattern instead of range loop - Apply cargo fmt to profile.rs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent faa8746 commit 210073c

10 files changed

Lines changed: 19 additions & 18 deletions

File tree

crates/ringkernel-cli/src/commands/profile.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ pub async fn execute(
196196

197197
// Check if kernel file exists (for file-based profiling)
198198
let kernel_path = Path::new(kernel);
199-
let is_file_based =
200-
kernel_path.exists() && kernel_path.extension().is_some_and(|e| e == "rs");
199+
let is_file_based = kernel_path.exists() && kernel_path.extension().is_some_and(|e| e == "rs");
201200

202201
let result = if is_file_based {
203202
profile_kernel_file(&config).await?

crates/ringkernel-core/src/checkpoint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,10 +1174,10 @@ mod tests {
11741174
#[test]
11751175
fn test_checkpoint_validation() {
11761176
// Test invalid magic
1177-
let mut bytes = vec![0u8; 64];
1177+
let mut bytes = [0u8; 64];
11781178
bytes[0..8].copy_from_slice(&0u64.to_le_bytes()); // Wrong magic
11791179

1180-
let header = CheckpointHeader::from_bytes(bytes[0..64].try_into().unwrap());
1180+
let header = CheckpointHeader::from_bytes(&bytes);
11811181
assert!(header.validate().is_err());
11821182
}
11831183

crates/ringkernel-core/src/multi_gpu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2939,7 +2939,7 @@ mod tests {
29392939
let migrator = KernelMigrator::with_storage(coord.clone(), storage);
29402940

29412941
// Verify we can access the coordinator
2942-
assert!(Arc::ptr_eq(&migrator.coordinator(), &coord));
2942+
assert!(Arc::ptr_eq(migrator.coordinator(), &coord));
29432943
}
29442944

29452945
#[test]

crates/ringkernel-core/src/runtime_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ mod tests {
14431443
metrics.is_empty()
14441444
|| metrics.contains('#')
14451445
|| metrics.contains('\n')
1446-
|| metrics.len() > 0
1446+
|| !metrics.is_empty()
14471447
);
14481448
}
14491449

crates/ringkernel-core/src/state.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,12 @@ mod tests {
545545
fn test_embedded_state_size_check() {
546546
// This should compile - TestState is exactly 24 bytes
547547
assert_eq!(std::mem::size_of::<TestState>(), 24);
548-
let _ = <TestState as EmbeddedStateSize>::SIZE_CHECK;
548+
// Force compile-time size check evaluation
549+
assert_eq!(<TestState as EmbeddedStateSize>::SIZE_CHECK, ());
549550

550551
// SmallState is smaller - also OK
551552
assert!(std::mem::size_of::<SmallState>() <= CONTROL_BLOCK_STATE_SIZE);
552-
let _ = <SmallState as EmbeddedStateSize>::SIZE_CHECK;
553+
// Force compile-time size check evaluation
554+
assert_eq!(<SmallState as EmbeddedStateSize>::SIZE_CHECK, ());
553555
}
554556
}

crates/ringkernel-cpu/src/mock.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,11 @@ mod tests {
651651
fn test_mock_shared_memory() {
652652
let shmem = MockSharedMemory::new(1024);
653653

654-
shmem.write::<f32>(0, 3.14);
655-
shmem.write::<f32>(4, 2.71);
654+
shmem.write::<f32>(0, 3.125);
655+
shmem.write::<f32>(4, 2.75);
656656

657-
assert!((shmem.read::<f32>(0) - 3.14).abs() < 0.001);
658-
assert!((shmem.read::<f32>(4) - 2.71).abs() < 0.001);
657+
assert!((shmem.read::<f32>(0) - 3.125).abs() < 0.001);
658+
assert!((shmem.read::<f32>(4) - 2.75).abs() < 0.001);
659659

660660
shmem.write_slice::<u32>(100, &[1, 2, 3, 4]);
661661
let slice = shmem.as_slice::<u32>(100, 4);

crates/ringkernel-graph/src/algorithms/bfs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ mod tests {
258258
let distances = bfs_sequential(&adj, &[NodeId(0)]).unwrap();
259259

260260
assert_eq!(distances[0], Distance::new(0));
261-
for i in 1..5 {
262-
assert_eq!(distances[i], Distance::new(1));
261+
for d in distances.iter().take(5).skip(1) {
262+
assert_eq!(*d, Distance::new(1));
263263
}
264264
}
265265

crates/ringkernel-ir/src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ mod tests {
571571
let x = builder.parameter("x", IrType::ptr(IrType::F32));
572572
let y = builder.parameter("y", IrType::ptr(IrType::F32));
573573

574-
let idx = builder.thread_id(Dimension::X);
574+
let _idx = builder.thread_id(Dimension::X);
575575
let x_val = builder.load(x);
576576
let y_val = builder.load(y);
577577
let result = builder.add(x_val, y_val);
@@ -588,7 +588,7 @@ mod tests {
588588
let mut builder = IrBuilder::new("test");
589589

590590
let a = builder.const_i32(42);
591-
let b = builder.const_f32(3.14);
591+
let b = builder.const_f32(3.125);
592592
let c = builder.const_bool(true);
593593

594594
let module = builder.build();

crates/ringkernel-ir/src/lower_wgsl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ mod tests {
846846
fn test_lower_with_subgroups() {
847847
let mut builder = IrBuilder::new("subgroup");
848848

849-
let val = builder.const_bool(true);
849+
let _val = builder.const_bool(true);
850850
// WarpVote requires subgroups capability
851851

852852
builder.ret();

crates/ringkernel-ir/src/nodes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ mod tests {
538538
#[test]
539539
fn test_constant_ir_type() {
540540
assert_eq!(ConstantValue::I32(42).ir_type(), IrType::I32);
541-
assert_eq!(ConstantValue::F32(3.14).ir_type(), IrType::F32);
541+
assert_eq!(ConstantValue::F32(3.125).ir_type(), IrType::F32);
542542
assert_eq!(ConstantValue::Bool(true).ir_type(), IrType::BOOL);
543543
}
544544

0 commit comments

Comments
 (0)