Skip to content

Commit 1d5abf4

Browse files
committed
Clippy cleanup: reduce warnings from 191 to 24 across workspace
- Migrate deprecated bundle_byte_slices → try_bundle_byte_slices (rustynum_accel, bind_space) - Migrate deprecated rng.gen() → rng.random() (spo.rs) - Replace Default::default() mutation patterns with struct literals (lance.rs, lance_persistence.rs) - Fix .clone() on Copy type [u64; 256] (proof_tactics.rs) - Fix filter_map → map where Some always returned (flight/server.rs) - Fix .clone() on double reference → dereference (cypher_bridge.rs) - Fix is_multiple_of clippy lint (wide_container.rs) - Fix loop-indexing → iter_mut().enumerate() (wide_meta.rs) - Fix manual slice copy → copy_from_slice (wide_meta.rs) - Remove unused imports and variables across spo/, orchestration/, flight/ - Fix redundant field names in struct init (causal_trajectory.rs) Remaining 24 warnings: 21 crewai-rust dead code, 2 n8n-core, 1 spo::spo module naming. https://claude.ai/code/session_0152b2NJYnjCJjvMAmgsTx3p
1 parent 788bfed commit 1d5abf4

28 files changed

Lines changed: 68 additions & 87 deletions

crates/ladybug-contract/src/wide_container.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl WideContainer {
190190
return items[0].clone();
191191
}
192192
let threshold = items.len() / 2;
193-
let even = items.len() % 2 == 0;
193+
let even = items.len().is_multiple_of(2);
194194
let mut result = WideContainer::zero();
195195
for word in 0..WIDE_WORDS {
196196
let mut out = 0u64;

crates/ladybug-contract/src/wide_meta.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ impl<'a> WideMetaView<'a> {
355355
/// Read all 10 layer activations.
356356
pub fn layer_activations(&self) -> [f64; 10] {
357357
let mut out = [0.0f64; 10];
358-
for i in 0..10 {
359-
out[i] = f64::from_bits(self.words[W_LAYER10_BASE + i]);
358+
for (i, slot) in out.iter_mut().enumerate() {
359+
*slot = f64::from_bits(self.words[W_LAYER10_BASE + i]);
360360
}
361361
out
362362
}
@@ -632,9 +632,7 @@ impl<'a> WideMetaViewMut<'a> {
632632
self.words[W_SPINE_BASE + i] = 0;
633633
}
634634
let n = ancestors.len().min(MAX_SPINE_DEPTH);
635-
for i in 0..n {
636-
self.words[W_SPINE_BASE + i] = ancestors[i];
637-
}
635+
self.words[W_SPINE_BASE..W_SPINE_BASE + n].copy_from_slice(&ancestors[..n]);
638636
}
639637

640638
// ====================================================================

src/core/rustynum_accel.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ pub fn container_bundle(items: &[&Container]) -> Container {
141141
.map(|c| view_u64_as_bytes(&c.words))
142142
.collect();
143143

144-
let result_bytes = rustynum_rs::NumArrayU8::bundle_byte_slices(&slices);
144+
let result_bytes = rustynum_rs::NumArrayU8::try_bundle_byte_slices(&slices)
145+
.expect("bundle_byte_slices: all slices same length");
145146

146147
// Convert back to Container
147148
let mut container = Container::zero();

src/cypher_bridge.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ fn properties_to_fingerprint(
470470
let mut content = label.to_string();
471471
// Sort properties for determinism
472472
let mut sorted: Vec<_> = properties.iter().collect();
473-
sorted.sort_by_key(|(k, _)| k.clone());
473+
sorted.sort_by_key(|(k, _)| *k);
474474
for (k, v) in sorted {
475475
content.push(':');
476476
content.push_str(k);
@@ -618,12 +618,10 @@ fn parse_where_clause(s: &str) -> Result<WhereClause, String> {
618618
/// Extract label from a MATCH/MERGE/CREATE pattern like "(n:System {...})"
619619
fn extract_label(cypher: &str) -> Option<String> {
620620
// Find first (variable:Label pattern
621-
let mut in_parens = false;
622621
let chars: Vec<char> = cypher.chars().collect();
623622
let mut i = 0;
624623
while i < chars.len() {
625624
if chars[i] == '(' {
626-
in_parens = true;
627625
i += 1;
628626
// Skip whitespace
629627
while i < chars.len() && chars[i].is_whitespace() { i += 1; }
@@ -661,7 +659,7 @@ fn parse_node_pattern(cypher: &str) -> Result<(Vec<String>, HashMap<String, Cyph
661659
let label_part = &inner[..brace_start];
662660

663661
for part in label_part.split(':').skip(1) {
664-
let label = part.trim().split_whitespace().next().unwrap_or("").to_string();
662+
let label = part.split_whitespace().next().unwrap_or("").to_string();
665663
if !label.is_empty() {
666664
labels.push(label);
667665
}

src/flight/crew_actions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ pub fn execute_crew_action(
489489
"persona.attach_yaml" => {
490490
let yaml = std::str::from_utf8(body).map_err(|e| format!("Invalid UTF-8: {}", e))?;
491491

492-
let persona = crate::orchestration::persona::Persona::from_yaml(yaml)?;
492+
let _persona = crate::orchestration::persona::Persona::from_yaml(yaml)?;
493493
// Extract agent_slot from first line comment or separate field
494494
// For now, require JSON wrapper with agent_slot
495495
#[derive(serde::Deserialize)]

src/flight/server.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,7 +1257,7 @@ fn build_search_result_data(
12571257
) -> Vec<(u16, [u64; FINGERPRINT_WORDS], Option<String>, u32, f32, u8)> {
12581258
results
12591259
.iter()
1260-
.filter_map(|(idx, dist)| {
1260+
.map(|(idx, dist)| {
12611261
// Get fingerprint from HDR index
12621262
// Note: We don't have direct address mapping, so we use index as pseudo-address
12631263
// In a real implementation, HDR index would store (addr, fingerprint) pairs
@@ -1272,14 +1272,14 @@ fn build_search_result_data(
12721272
};
12731273

12741274
// Return placeholder fingerprint - real impl would look up from index
1275-
Some((
1275+
(
12761276
addr,
12771277
[0u64; FINGERPRINT_WORDS],
12781278
None,
12791279
*dist,
12801280
similarity,
12811281
cascade_level,
1282-
))
1282+
)
12831283
})
12841284
.collect()
12851285
}

src/orchestration/crew_bridge.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@
3434
3535
use super::a2a::{A2AMessage, A2AProtocol, DeliveryStatus};
3636
use super::agent_card::{AgentCard, AgentRegistry};
37-
use super::blackboard_agent::{AgentBlackboard, BlackboardRegistry};
37+
use super::blackboard_agent::BlackboardRegistry;
3838
use super::handover::{HandoverDecision, HandoverPolicy};
3939
use super::kernel_extensions::{
4040
FilterPipeline, KernelGuardrail, MemoryBank, ObservabilityManager, VerificationEngine,
4141
};
4242
use super::meta_orchestrator::MetaOrchestrator;
43-
use super::persona::{Persona, PersonaRegistry};
43+
use super::persona::PersonaRegistry;
4444
use super::semantic_kernel::SemanticKernel;
4545
use super::thinking_template::{ThinkingTemplate, ThinkingTemplateRegistry};
46-
use crate::storage::bind_space::{Addr, BindSpace, FINGERPRINT_WORDS};
46+
use crate::storage::bind_space::{Addr, BindSpace};
4747
use serde::{Deserialize, Serialize};
4848

4949
/// Task status in the dispatch pipeline

src/orchestration/handover.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//! 4. **Dunning-Kruger guard** — agents with low coherence but high
2424
//! confidence are flagged for metacognitive review
2525
26-
use crate::cognitive::{GateState, ThinkingStyle};
26+
use crate::cognitive::GateState;
2727
use serde::{Deserialize, Serialize};
2828

2929
// =============================================================================

src/orchestration/kernel_extensions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
//! └───────────────────────────────────────────────────────────────────────┘
5151
//! ```
5252
53-
use super::semantic_kernel::{CausalRung, KernelTruth, KernelZone};
53+
use super::semantic_kernel::{KernelTruth, KernelZone};
5454
use crate::storage::bind_space::{Addr, BindSpace, FINGERPRINT_WORDS};
5555
use serde::{Deserialize, Serialize};
5656

src/spo/causal_trajectory.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@
3434
//! DN mutation guidance, and warm-start capability.
3535
3636
use rustynum_bnn::causal_trajectory::{
37-
CausalArrow, CausalChain, CausalDirection, CausalLink, CausalRelation, CausalSaliency,
38-
CausalTrajectory, DominantPlane, EwmCorrection, EwmTier, HaloTransition,
39-
NarsCausalStatement, NarsTruth, ResonatorSnapshot, RifDiff, SigmaEdge, SigmaNode,
37+
CausalArrow, CausalChain, CausalDirection, CausalRelation, CausalSaliency,
38+
CausalTrajectory, DominantPlane,
39+
NarsCausalStatement, NarsTruth, ResonatorSnapshot, SigmaEdge,
4040
};
41-
use rustynum_bnn::{GrowthPath, HaloType, InferenceMode, MutationOp};
42-
use rustynum_core::{CollapseGate, SigmaGate, SignificanceLevel};
41+
use rustynum_bnn::{GrowthPath, InferenceMode, MutationOp};
42+
use rustynum_core::{CollapseGate, SigmaGate};
4343

4444
use crate::nars::TruthValue;
4545
use super::gestalt::GestaltState;
46-
use super::spo_harvest::{Plane, SpoDistanceResult, TypedHalo};
46+
use super::spo_harvest::{Plane, SpoDistanceResult};
4747
use super::shift_detector::SpoShiftDetector;
4848

4949
// =============================================================================
@@ -201,7 +201,7 @@ impl TrajectoryHydrator {
201201
edge: edge.clone(),
202202
truth: nars_to_truth(&edge.truth),
203203
growth_path: Some(growth_path),
204-
gestalt: gestalt.clone(),
204+
gestalt,
205205
})
206206
.collect();
207207

0 commit comments

Comments
 (0)