diff --git a/arl/arl-rs/crates/arl-cli/src/main.rs b/arl/arl-rs/crates/arl-cli/src/main.rs index 4dded5176..22d62196e 100644 --- a/arl/arl-rs/crates/arl-cli/src/main.rs +++ b/arl/arl-rs/crates/arl-cli/src/main.rs @@ -291,7 +291,7 @@ mod tests { ); let mut h = EchoHarness::new("h"); let eval = sup - .evaluate("sut", &mut h, "q", &"ab".repeat(32), 1, 2, false, false) + .evaluate("sut", &mut h, "q", "ab".repeat(32), 1, 2, false, false) .unwrap(); let session_json = serde_json::to_string(&eval.session).unwrap(); let att_json = serde_json::to_string(&eval.attestation).unwrap(); diff --git a/arl/arl-rs/crates/arl-core/src/axes.rs b/arl/arl-rs/crates/arl-core/src/axes.rs index b66fb55e7..217894355 100644 --- a/arl/arl-rs/crates/arl-core/src/axes.rs +++ b/arl/arl-rs/crates/arl-core/src/axes.rs @@ -65,6 +65,7 @@ impl Default for ValidationDepth { /// How stochastic the system is on the certified task. `A` is the most /// deterministic; `E` (uncharacterized) is the default. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Default)] pub enum ConvergenceClass { /// Deterministic equivalent (≥100 identical/equivalent runs). A, @@ -75,6 +76,7 @@ pub enum ConvergenceClass { /// Divergent on extension (stable short, diverges with length/depth). D, /// Uncharacterized. Variance never measured. Default. + #[default] E, } @@ -97,11 +99,6 @@ impl ConvergenceClass { } } -impl Default for ConvergenceClass { - fn default() -> Self { - ConvergenceClass::E - } -} // ───────────────────────────────────────────────────────────────────── // Security Class (S0–S4) — information theory + cryptography @@ -110,8 +107,10 @@ impl Default for ConvergenceClass { /// Measured resistance to adversarial conditions. `S0` (uncharacterized) /// is the default; `S4` (complete auditability) is the ceiling. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Default)] pub enum SecurityClass { /// Uncharacterized. No security measurement. Default. + #[default] S0, /// Adversarial robustness measured (attack success rate published). S1, @@ -141,11 +140,6 @@ impl SecurityClass { } } -impl Default for SecurityClass { - fn default() -> Self { - SecurityClass::S0 - } -} // ───────────────────────────────────────────────────────────────────── // Energy Profile (joules) — thermodynamics @@ -155,8 +149,10 @@ impl Default for SecurityClass { /// to disclose is a *valid state* — it just caps the achievable ARL at 3 /// (enforced by [`crate::Claim::validate`]). #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Default)] pub enum EnergyProfile { /// Energy not disclosed. Caps the score at ARL 3. + #[default] Undisclosed, /// All three figures disclosed. Disclosed { @@ -184,11 +180,6 @@ impl EnergyProfile { } } -impl Default for EnergyProfile { - fn default() -> Self { - EnergyProfile::Undisclosed - } -} #[cfg(test)] mod tests { diff --git a/arl/arl-rs/crates/arl-sandbox/src/attest.rs b/arl/arl-rs/crates/arl-sandbox/src/attest.rs index 38eadade9..c5b37703d 100644 --- a/arl/arl-rs/crates/arl-sandbox/src/attest.rs +++ b/arl/arl-rs/crates/arl-sandbox/src/attest.rs @@ -129,7 +129,7 @@ fn to_hex(bytes: &[u8]) -> String { } fn from_hex(s: &str, field: &'static str) -> Result, AttestError> { - if s.len() % 2 != 0 { + if !s.len().is_multiple_of(2) { return Err(AttestError::BadHex(field)); } let bytes = s.as_bytes(); diff --git a/arl/arl-rs/crates/arl-sandbox/src/supervisor.rs b/arl/arl-rs/crates/arl-sandbox/src/supervisor.rs index 44f3fc00d..fd53b7cf9 100644 --- a/arl/arl-rs/crates/arl-sandbox/src/supervisor.rs +++ b/arl/arl-rs/crates/arl-sandbox/src/supervisor.rs @@ -272,7 +272,7 @@ mod tests { "model-x v2", &mut harness, "what is the capital of france", - &"ab".repeat(32), + "ab".repeat(32), 1_900_000_000, 1_931_536_000, false, @@ -298,7 +298,7 @@ mod tests { let mut sup = Supervisor::new("sup-1", key(), IsolationTier::Tier1, NullPhysicalSource); let mut harness = EchoHarness::new("harness v1"); let eval = sup - .evaluate("sut", &mut harness, "hi", &"0".repeat(64), 1, 2, false, false) + .evaluate("sut", &mut harness, "hi", "0".repeat(64), 1, 2, false, false) .unwrap(); assert!(!eval.session.telemetry.physical); // Tier 1 (ARL 4) requires all three categories → fails honestly. @@ -310,8 +310,8 @@ mod tests { fn session_ids_are_unique_per_supervisor() { let mut sup = Supervisor::new("sup-1", key(), IsolationTier::Tier0, NullPhysicalSource); let mut h = EchoHarness::new("h"); - let a = sup.evaluate("s", &mut h, "x", &"0".repeat(64), 1, 2, false, false).unwrap(); - let b = sup.evaluate("s", &mut h, "y", &"0".repeat(64), 1, 2, false, false).unwrap(); + let a = sup.evaluate("s", &mut h, "x", "0".repeat(64), 1, 2, false, false).unwrap(); + let b = sup.evaluate("s", &mut h, "y", "0".repeat(64), 1, 2, false, false).unwrap(); assert_ne!(a.session.session_id, b.session.session_id); } @@ -325,7 +325,7 @@ mod tests { ); let mut h = EchoHarness::new("h"); let eval = sup - .evaluate("s", &mut h, "x", &"0".repeat(64), 1, 2, false, /* tampering */ true) + .evaluate("s", &mut h, "x", "0".repeat(64), 1, 2, false, /* tampering */ true) .unwrap(); assert!(eval.session.tampering_detected); // Attestation still verifies (it faithfully signs that tampering diff --git a/eoc/eoc-rs/crates/eoc-distributed/src/router.rs b/eoc/eoc-rs/crates/eoc-distributed/src/router.rs index acc18d077..d04e9c2de 100644 --- a/eoc/eoc-rs/crates/eoc-distributed/src/router.rs +++ b/eoc/eoc-rs/crates/eoc-distributed/src/router.rs @@ -22,6 +22,7 @@ use crate::worker::{Load, Worker}; /// Routing strategy. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Default)] pub enum Strategy { /// Round-robin across satisfying workers. RoundRobin, @@ -30,6 +31,7 @@ pub enum Strategy { /// Lowest projected p50 latency. LatencyWeighted, /// Lowest projected joule cost for a hypothetical N-token request. + #[default] JouleWeighted, /// Lowest projected gCO2e for a hypothetical N-token request. CarbonWeighted, @@ -53,11 +55,6 @@ pub struct Router { rr_counter: AtomicUsize, } -impl Default for Strategy { - fn default() -> Self { - Strategy::JouleWeighted - } -} impl Router { /// Construct. diff --git a/eoc/eoc-rs/crates/eoc-observability/src/span.rs b/eoc/eoc-rs/crates/eoc-observability/src/span.rs index 1f4cc79bd..a895c94d0 100644 --- a/eoc/eoc-rs/crates/eoc-observability/src/span.rs +++ b/eoc/eoc-rs/crates/eoc-observability/src/span.rs @@ -20,8 +20,10 @@ use serde::{Deserialize, Serialize}; /// Span kind, per OTel. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[derive(Default)] pub enum SpanKind { /// Default; an internal operation. + #[default] Internal, /// Synchronous outbound call. Client, @@ -33,16 +35,13 @@ pub enum SpanKind { Consumer, } -impl Default for SpanKind { - fn default() -> Self { - SpanKind::Internal - } -} /// Status code per OTel. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[derive(Default)] pub enum StatusCode { /// Default, unset by SDK. + #[default] Unset, /// Operation succeeded. Ok, @@ -50,11 +49,6 @@ pub enum StatusCode { Error, } -impl Default for StatusCode { - fn default() -> Self { - StatusCode::Unset - } -} /// Span status: a code plus optional human-readable description. #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] diff --git a/eoc/eoc-rs/crates/eoc-quantize/tests/nf4_distribution.rs b/eoc/eoc-rs/crates/eoc-quantize/tests/nf4_distribution.rs index 2743d95db..4fb5126d7 100644 --- a/eoc/eoc-rs/crates/eoc-quantize/tests/nf4_distribution.rs +++ b/eoc/eoc-rs/crates/eoc-quantize/tests/nf4_distribution.rs @@ -24,7 +24,7 @@ fn strictly_increasing() { #[test] fn contains_zero() { - assert!(NF4_LEVELS.iter().any(|&v| v == 0.0)); + assert!(NF4_LEVELS.contains(&0.0)); } #[test] diff --git a/eoc/eoc-rs/crates/eoc-rag/src/citation.rs b/eoc/eoc-rs/crates/eoc-rag/src/citation.rs index d19baf5cd..2b609084c 100644 --- a/eoc/eoc-rs/crates/eoc-rag/src/citation.rs +++ b/eoc/eoc-rs/crates/eoc-rag/src/citation.rs @@ -58,22 +58,19 @@ impl Cite { /// What the caller wants the pipeline to do about citations. #[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Default)] pub enum CitationPolicy { /// Citations are optional — the pipeline may return an answer with /// none. Optional, /// At least one citation must be attached, otherwise the answer is /// rejected. + #[default] Required, /// Every retrieved chunk must contribute a citation. PerChunk, } -impl Default for CitationPolicy { - fn default() -> Self { - CitationPolicy::Required - } -} /// Enforcement gate. Pipelines call [`CitationEnforcement::enforce`] /// just before returning. diff --git a/eoc/eoc-rs/crates/eoc-safety/src/pii.rs b/eoc/eoc-rs/crates/eoc-safety/src/pii.rs index 2064fd335..b0d0e8679 100644 --- a/eoc/eoc-rs/crates/eoc-safety/src/pii.rs +++ b/eoc/eoc-rs/crates/eoc-safety/src/pii.rs @@ -143,5 +143,5 @@ fn luhn_valid(s: &str) -> bool { sum += x; alt = !alt; } - sum % 10 == 0 + sum.is_multiple_of(10) } diff --git a/eoc/eoc-rs/crates/eoc-streaming/tests/anthropic_event_mapping.rs b/eoc/eoc-rs/crates/eoc-streaming/tests/anthropic_event_mapping.rs index f20d40c69..716ce4b8a 100644 --- a/eoc/eoc-rs/crates/eoc-streaming/tests/anthropic_event_mapping.rs +++ b/eoc/eoc-rs/crates/eoc-streaming/tests/anthropic_event_mapping.rs @@ -16,8 +16,7 @@ fn sse(event: &str, data: &str) -> SseEvent { #[test] fn full_text_message_lifecycle() { let m = AnthropicMapper; - let frames = vec![ - sse( + let frames = [sse( "message_start", r#"{"message":{"id":"msg_01","role":"assistant"}}"#, ), @@ -38,8 +37,7 @@ fn full_text_message_lifecycle() { "message_delta", r#"{"delta":{"stop_reason":"end_turn"}}"#, ), - sse("message_stop", r#"{}"#), - ]; + sse("message_stop", r#"{}"#)]; let mut events: Vec = Vec::new(); for f in frames.iter() { diff --git a/jcp/jcp-rs/crates/jcp-action-receipt/src/bin/ar-verify.rs b/jcp/jcp-rs/crates/jcp-action-receipt/src/bin/ar-verify.rs index cc952201d..485f6077c 100644 --- a/jcp/jcp-rs/crates/jcp-action-receipt/src/bin/ar-verify.rs +++ b/jcp/jcp-rs/crates/jcp-action-receipt/src/bin/ar-verify.rs @@ -92,7 +92,7 @@ fn read_envelope(path: &str) -> Result, String> { let raw = std::fs::read(path).map_err(|e| e.to_string())?; if let Ok(text) = std::str::from_utf8(&raw) { let t: String = text.split_whitespace().collect(); - if !t.is_empty() && t.len() % 2 == 0 && t.bytes().all(|c| c.is_ascii_hexdigit()) { + if !t.is_empty() && t.len().is_multiple_of(2) && t.bytes().all(|c| c.is_ascii_hexdigit()) { return hex::decode(&t).map_err(|e| e.to_string()); } } diff --git a/jcp/jcp-rs/crates/jcp-efficiency/src/dynamics.rs b/jcp/jcp-rs/crates/jcp-efficiency/src/dynamics.rs index eb7ff80a3..372aed757 100644 --- a/jcp/jcp-rs/crates/jcp-efficiency/src/dynamics.rs +++ b/jcp/jcp-rs/crates/jcp-efficiency/src/dynamics.rs @@ -621,7 +621,7 @@ pub fn observe_shape(windows: &[EnergyWindow], idle_floor_uj: u64) -> Option mean { x - mean } else { mean - x } + x.abs_diff(mean) }) .sum::() / n; diff --git a/jcp/jcp-rs/crates/jcp-runtime/src/lib.rs b/jcp/jcp-rs/crates/jcp-runtime/src/lib.rs index a3e76ef79..e10a7274f 100644 --- a/jcp/jcp-rs/crates/jcp-runtime/src/lib.rs +++ b/jcp/jcp-rs/crates/jcp-runtime/src/lib.rs @@ -1821,12 +1821,12 @@ mod tests { let mut rt = Runtime::new(); // Plain chain path: no facts under a ceiling ⇒ fail closed. assert_eq!( - rt.decide_chained(&f, &[root_sg.clone()], did(&holder), Energy::measured(10), 10).verdict, + rt.decide_chained(&f, std::slice::from_ref(&root_sg), did(&holder), Energy::measured(10), 10).verdict, Verdict::Deny(DenyReason::TaintedFlow), ); // Flow chain path: a tainted argument is denied. assert_eq!( - rt.decide_chained_flow(&f, &[root_sg.clone()], did(&holder), Energy::measured(10), 10, &tainted(7)).verdict, + rt.decide_chained_flow(&f, std::slice::from_ref(&root_sg), did(&holder), Energy::measured(10), 10, &tainted(7)).verdict, Verdict::Deny(DenyReason::TaintedFlow), ); // A clean argument passes. diff --git a/joule-code/joule-code-rs/crates/joule-code-reviewer/examples/review.rs b/joule-code/joule-code-rs/crates/joule-code-reviewer/examples/review.rs index 48ea5569b..7591913cc 100644 --- a/joule-code/joule-code-rs/crates/joule-code-reviewer/examples/review.rs +++ b/joule-code/joule-code-rs/crates/joule-code-reviewer/examples/review.rs @@ -59,7 +59,7 @@ fn main() { let claimed: Vec = clauses.iter().map(|c| c.to_string()).collect(); let reviews = reviewer.review(&o, &spec, &claimed).unwrap(); let verdict = if approval(&o, &reviews).is_approved() { "✓ APPROVED" } else { "⛔ SENT BACK" }; - println!("{label}\n {verdict} (reviewer principal {}…)", &hex8(reviewer.principal())); + println!("{label}\n {verdict} (reviewer principal {}…)", hex8(reviewer.principal())); for r in &reviews { let mark = if r.review.verdict == ReviewVerdict::Approve { "✓" } else { "✗" }; print!(" {mark} {:?}", r.review.stage); diff --git a/joule-code/joule-code-rs/crates/joule-moq/examples/quic_xnet.rs b/joule-code/joule-code-rs/crates/joule-moq/examples/quic_xnet.rs index 34598d07d..3b36b518c 100644 --- a/joule-code/joule-code-rs/crates/joule-moq/examples/quic_xnet.rs +++ b/joule-code/joule-code-rs/crates/joule-moq/examples/quic_xnet.rs @@ -35,7 +35,7 @@ fn hex_encode(bytes: &[u8]) -> String { #[cfg(feature = "quic")] fn hex_decode(s: &str) -> Result, Box> { let s = s.trim(); - if s.len() % 2 != 0 { + if !s.len().is_multiple_of(2) { return Err("odd-length hex".into()); } (0..s.len()) diff --git a/joule-code/joule-code-rs/crates/joule-moq/src/receipt.rs b/joule-code/joule-code-rs/crates/joule-moq/src/receipt.rs index 92bda3e77..cc1de9972 100644 --- a/joule-code/joule-code-rs/crates/joule-moq/src/receipt.rs +++ b/joule-code/joule-code-rs/crates/joule-moq/src/receipt.rs @@ -936,8 +936,8 @@ impl Chain { } fn remember_within(&mut self, link: [u8; 32], digest: [u8; 32], cap: usize) { - if !self.links.contains_key(&link) { - self.links.insert(link, digest); + if let std::collections::btree_map::Entry::Vacant(e) = self.links.entry(link) { + e.insert(digest); self.links_order.push_back(link); while self.links_order.len() > cap { if let Some(old) = self.links_order.pop_front() { diff --git a/joule-code/joule-code-rs/crates/joule-moq/src/wai_dispatch.rs b/joule-code/joule-code-rs/crates/joule-moq/src/wai_dispatch.rs index b2ae95bd5..8f515c7bf 100644 --- a/joule-code/joule-code-rs/crates/joule-moq/src/wai_dispatch.rs +++ b/joule-code/joule-code-rs/crates/joule-moq/src/wai_dispatch.rs @@ -119,7 +119,7 @@ pub const KNOWN_CAPABILITIES: &[&str] = &[ /// known `comms.*` extensions. Linear scan — the registry is tiny. #[inline] pub fn is_known_capability(cap: &str) -> bool { - KNOWN_CAPABILITIES.iter().any(|&k| k == cap) + KNOWN_CAPABILITIES.contains(&cap) } /// True iff `cap` is one of the three mandatory-floor capabilities every diff --git a/joule-ui/joule-ui-rs/crates/joule-ui-conformance/tests/pack.rs b/joule-ui/joule-ui-rs/crates/joule-ui-conformance/tests/pack.rs index d7ecbe3c2..4b12953ba 100644 --- a/joule-ui/joule-ui-rs/crates/joule-ui-conformance/tests/pack.rs +++ b/joule-ui/joule-ui-rs/crates/joule-ui-conformance/tests/pack.rs @@ -37,7 +37,7 @@ fn field(v: &Value, key: &str) -> T { } fn unhex(s: &str) -> Vec { - assert!(s.len() % 2 == 0, "odd-length hex"); + assert!(s.len().is_multiple_of(2), "odd-length hex"); (0..s.len()) .step_by(2) .map(|i| u8::from_str_radix(&s[i..i + 2], 16).expect("hex digit")) diff --git a/joule-ui/joule-ui-rs/crates/joule-ui-core/src/lib.rs b/joule-ui/joule-ui-rs/crates/joule-ui-core/src/lib.rs index 857ca4f07..dd8a28313 100644 --- a/joule-ui/joule-ui-rs/crates/joule-ui-core/src/lib.rs +++ b/joule-ui/joule-ui-rs/crates/joule-ui-core/src/lib.rs @@ -583,12 +583,11 @@ pub fn apply_delta(tree: &mut Widget, delta: &UiDelta) -> Result<(), ApplyError> /// need transactional semantics.) pub fn apply_deltas(tree: &mut Widget, deltas: &[UiDelta]) -> Result { for (i, d) in deltas.iter().enumerate() { - apply_delta(tree, d).map_err(|e| { + apply_delta(tree, d).inspect_err(|_e| { // Preserve the failing index in tracing by returning the // err as-is; consumers can compute "first N succeeded" // from the tree itself if needed. let _ = i; - e })?; } Ok(deltas.len()) diff --git a/joulecontract/joulecontract-rs/crates/joulecontract-conformance/src/lib.rs b/joulecontract/joulecontract-rs/crates/joulecontract-conformance/src/lib.rs index 8780003ac..db76c3c41 100644 --- a/joulecontract/joulecontract-rs/crates/joulecontract-conformance/src/lib.rs +++ b/joulecontract/joulecontract-rs/crates/joulecontract-conformance/src/lib.rs @@ -510,7 +510,7 @@ mod negative_vector_replay { "{name}: demotion list" ); assert_eq!( - serde_json::to_value(&verdict.max_profile).unwrap(), + serde_json::to_value(verdict.max_profile).unwrap(), expected["max_profile"], "{name}: maximum permitted profile" ); diff --git a/joulecontract/joulecontract-rs/crates/joulecontract-seal/src/lib.rs b/joulecontract/joulecontract-rs/crates/joulecontract-seal/src/lib.rs index a38b9a962..5dda11371 100644 --- a/joulecontract/joulecontract-rs/crates/joulecontract-seal/src/lib.rs +++ b/joulecontract/joulecontract-rs/crates/joulecontract-seal/src/lib.rs @@ -204,7 +204,7 @@ mod hex { bytes.as_ref().iter().map(|b| format!("{b:02x}")).collect() } pub fn decode(s: &str) -> Result, ()> { - if s.len() % 2 != 0 { + if !s.len().is_multiple_of(2) { return Err(()); } (0..s.len()) diff --git a/map/map-rs/crates/map-tiles/src/tiles3d/mod.rs b/map/map-rs/crates/map-tiles/src/tiles3d/mod.rs index 1637669b4..5136d0040 100644 --- a/map/map-rs/crates/map-tiles/src/tiles3d/mod.rs +++ b/map/map-rs/crates/map-tiles/src/tiles3d/mod.rs @@ -584,7 +584,7 @@ mod tiles3d_tests { for i in idx { bin.extend_from_slice(&i.to_le_bytes()); } - while bin.len() % 4 != 0 { + while !bin.len().is_multiple_of(4) { bin.push(0); } let json = serde_json::json!({ diff --git a/sandbox/sandbox-rs/crates/sandbox-attest/src/fleet.rs b/sandbox/sandbox-rs/crates/sandbox-attest/src/fleet.rs index e91af3cc1..a46cd961c 100644 --- a/sandbox/sandbox-rs/crates/sandbox-attest/src/fleet.rs +++ b/sandbox/sandbox-rs/crates/sandbox-attest/src/fleet.rs @@ -129,7 +129,7 @@ impl FleetRecord { let mut idx = index; let mut siblings = Vec::new(); while level.len() > 1 { - let sib = if idx % 2 == 0 { + let sib = if idx.is_multiple_of(2) { // sibling on the right (or self, duplicated, at an odd end) (*level.get(idx + 1).unwrap_or(&level[idx]), true) } else { diff --git a/smart-byte/smart-byte-rs/crates/smart-byte-acdc/src/edge.rs b/smart-byte/smart-byte-rs/crates/smart-byte-acdc/src/edge.rs index d7f14dc45..e9c7bd6eb 100644 --- a/smart-byte/smart-byte-rs/crates/smart-byte-acdc/src/edge.rs +++ b/smart-byte/smart-byte-rs/crates/smart-byte-acdc/src/edge.rs @@ -164,7 +164,7 @@ impl EdgeGraph { let node = self .nodes .get(said) - .ok_or_else(|| AcdcError::EdgeMissing(*said))?; + .ok_or(AcdcError::EdgeMissing(*said))?; Edge::parse_section(&node.e) } diff --git a/smart-byte/smart-byte-rs/crates/smart-byte-conformance/src/states.rs b/smart-byte/smart-byte-rs/crates/smart-byte-conformance/src/states.rs index 9ef8697c0..825d5400e 100644 --- a/smart-byte/smart-byte-rs/crates/smart-byte-conformance/src/states.rs +++ b/smart-byte/smart-byte-rs/crates/smart-byte-conformance/src/states.rs @@ -505,11 +505,11 @@ pub fn states(world: &World) -> J { Dropped("non_shortest_integer"), ), ( - canonical::encode(&Value::map([("melt", Value::map([("byte", Value::text(&byte.to_said_text()))]))])).unwrap(), + canonical::encode(&Value::map([("melt", Value::map([("byte", Value::text(byte.to_said_text()))]))])).unwrap(), Dropped("malformed_input"), ), ( - canonical::encode(&Value::map([("burn", Value::map([("byte", Value::text(&byte.to_said_text()))]))])).unwrap(), + canonical::encode(&Value::map([("burn", Value::map([("byte", Value::text(byte.to_said_text()))]))])).unwrap(), Dropped("malformed_input"), ), ( @@ -519,7 +519,7 @@ pub fn states(world: &World) -> J { ( "proposal", Value::map([ - ("cluster", Value::text(&cluster("A").to_said_text())), + ("cluster", Value::text(cluster("A").to_said_text())), ("sequence", Value::Unsigned(0)), ("change", Value::map([("action", Value::text("mint_anything"))])), ]), @@ -555,7 +555,7 @@ pub fn states(world: &World) -> J { canonical::encode(&Value::map([( "transfer", Value::map([ - ("byte", Value::text(&byte.to_said_text())), + ("byte", Value::text(byte.to_said_text())), ("transition", wire::to_value(&t).unwrap()), ("memo", Value::text("lunch")), ]), diff --git a/smart-byte/smart-byte-rs/crates/smart-byte-ilp/src/open_payments.rs b/smart-byte/smart-byte-rs/crates/smart-byte-ilp/src/open_payments.rs index eb04030f8..1df4ee48b 100644 --- a/smart-byte/smart-byte-rs/crates/smart-byte-ilp/src/open_payments.rs +++ b/smart-byte/smart-byte-rs/crates/smart-byte-ilp/src/open_payments.rs @@ -113,7 +113,7 @@ pub struct OpenPaymentsClient; impl OpenPaymentsClient { /// Construct a default client. pub fn new() -> Self { - Self::default() + Self } /// Serialise a resource to JSON. diff --git a/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/src/storage.rs b/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/src/storage.rs index e1be07b69..d77f9730c 100644 --- a/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/src/storage.rs +++ b/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/src/storage.rs @@ -49,7 +49,7 @@ impl MemoryStorage { #[async_trait] impl EventLogStorage for MemoryStorage { async fn append(&self, controller: &ControllerAid, event: KeyEvent) -> Result<()> { - self.logs.entry(controller.clone()).or_default().push(event); + self.logs.entry(*controller).or_default().push(event); Ok(()) } diff --git a/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/src/watcher.rs b/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/src/watcher.rs index 4faea9db3..1858af4cf 100644 --- a/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/src/watcher.rs +++ b/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/src/watcher.rs @@ -99,13 +99,13 @@ impl Watcher { r.verify_signature()?; } - let controller = event.controller().clone(); + let controller = *event.controller(); let sequence = event.sequence(); let said = event.said(); let mut entry = self .observed_controllers - .entry(controller.clone()) + .entry(controller) .or_default(); let log = entry.value_mut(); let bucket = log.by_sequence.entry(sequence).or_default(); @@ -121,7 +121,7 @@ impl Watcher { let a = bucket[0].event.said(); let b = bucket[1].event.said(); let signal = DuplicityDetected { - controller: controller.clone(), + controller, sequence, fork: (a, b), detected_at: Utc::now(), diff --git a/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/tests/integration.rs b/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/tests/integration.rs index 98af2d978..4570742f1 100644 --- a/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/tests/integration.rs +++ b/smart-byte/smart-byte-rs/crates/smart-byte-keri-witness/tests/integration.rs @@ -315,7 +315,7 @@ async fn witness_refuses_contradicting_receipt_and_watcher_detects() { fn clone_controller(src: &Controller) -> Controller { Controller { - aid: src.aid.clone(), + aid: src.aid, current_keys: src.current_keys.clone(), next_keys: src.next_keys.clone(), threshold: src.threshold, @@ -323,7 +323,7 @@ fn clone_controller(src: &Controller) -> Controller { witnesses: src.witnesses.clone(), witness_threshold: src.witness_threshold, key_event_log: src.key_event_log.clone(), - delegated_by: src.delegated_by.clone(), + delegated_by: src.delegated_by, } } @@ -433,7 +433,7 @@ async fn delegation_child_anchors_to_parent() { let ck = KeyPair::generate(&mut rng); let (child, dlg) = Controller::delegate( - parent.aid.clone(), + parent.aid, vec![ck], vec![KeyPair::generate(&mut rng)], Threshold(1), diff --git a/smart-byte/smart-byte-rs/crates/smart-byte-libp2p/src/event.rs b/smart-byte/smart-byte-rs/crates/smart-byte-libp2p/src/event.rs index 5293e34ef..3a5c696b4 100644 --- a/smart-byte/smart-byte-rs/crates/smart-byte-libp2p/src/event.rs +++ b/smart-byte/smart-byte-rs/crates/smart-byte-libp2p/src/event.rs @@ -91,7 +91,7 @@ fn translate(ev: SwarmEvent) -> Option { .. })) => Some(NodeEvent::DiscoveredViaKad(peer)), SwarmEvent::Behaviour(SmartByteBehaviourEvent::Relay( - relay::Event::ReservationReqAccepted { src_peer_id: _, .. }, + relay::Event::ReservationReqAccepted { .. }, )) => None, _ => None, } diff --git a/smart-byte/smart-byte-rs/crates/smart-byte-state/tests/lifecycle.rs b/smart-byte/smart-byte-rs/crates/smart-byte-state/tests/lifecycle.rs index 0a4026921..18580af8b 100644 --- a/smart-byte/smart-byte-rs/crates/smart-byte-state/tests/lifecycle.rs +++ b/smart-byte/smart-byte-rs/crates/smart-byte-state/tests/lifecycle.rs @@ -115,7 +115,7 @@ fn an_issuer_is_added_by_the_others_and_only_after_the_delay() { classes(&state.apply_frame(&[two])), vec![Err("below_quorum")] ); - assert_eq!(classes(&state.apply_frame(&[three.clone()])), vec![Ok(())]); + assert_eq!(classes(&state.apply_frame(std::slice::from_ref(&three))), vec![Ok(())]); assert_eq!(state.governance.pending.len(), 1); assert_eq!(state.governance.pending[0].effective, 2 + 1 + 2); diff --git a/wai/wai-rs/src/bin/wai.rs b/wai/wai-rs/src/bin/wai.rs index e0e931cdb..afac72d79 100644 --- a/wai/wai-rs/src/bin/wai.rs +++ b/wai/wai-rs/src/bin/wai.rs @@ -451,7 +451,7 @@ fn inspect(path: &str) -> Result<(), String> { println!(" renditions: {}", m.renditions.len()); println!(); println!(" rendition table (deployer-preferred order):"); - println!(" {:>3} {:>10} {:<28} {}", "idx", "bytes", "capability", "kind"); + println!(" {:>3} {:>10} {:<28} kind", "idx", "bytes", "capability"); for (i, (meta, payload)) in m.manifest.renditions.iter().zip(m.renditions.iter()).enumerate() { @@ -851,7 +851,7 @@ fn capabilities() -> Result<(), String> { if native.is_empty() { println!(" (built without the codecs feature: this binary decodes nothing natively)"); } - println!(" {:<26} {:<11} {:<13} {:<14} {:<21} {}", "capability", "fidelity", "decode", "license", "replicate", "role"); + println!(" {:<26} {:<11} {:<13} {:<14} {:<21} role", "capability", "fidelity", "decode", "license", "replicate"); println!(" {:-<26} {:-<11} {:-<13} {:-<14} {:-<21} {:-<11}", "", "", "", "", "", ""); for &c in caps { let tier = wai::codecs::capability_tier(c) diff --git a/wai/wai-rs/tests/ffi_robustness.rs b/wai/wai-rs/tests/ffi_robustness.rs index eccee6f13..534e470e0 100644 --- a/wai/wai-rs/tests/ffi_robustness.rs +++ b/wai/wai-rs/tests/ffi_robustness.rs @@ -116,7 +116,7 @@ fn png_decode_null_size_out() { #[test] fn flac_decode_garbage() { - let garbage = vec![0u8; 64]; + let garbage = [0u8; 64]; let mut out = empty_buf(); let mut sr = 0u32; let rc = unsafe { @@ -141,7 +141,7 @@ fn opus_encode_invalid_sr() { #[test] fn opus_decode_garbage() { - let garbage = vec![0u8; 16]; + let garbage = [0u8; 16]; let mut out = empty_buf(); let mut sr = 0u32; let rc = unsafe { @@ -164,7 +164,7 @@ fn zstd_decode_garbage() { #[test] fn xz_decode_garbage() { - let garbage = vec![0u8; 32]; + let garbage = [0u8; 32]; let mut out = empty_buf(); let rc = unsafe { wai_text_xz_decode(garbage.as_ptr(), garbage.len(), &mut out) @@ -245,7 +245,7 @@ fn av1_encode_zero_fps() { #[test] fn av1_decode_garbage() { - let garbage = vec![0u8; 64]; + let garbage = [0u8; 64]; let mut out = empty_buf(); let mut n = 0u32; let mut h = 0u32; let mut w = 0u32; let mut fn_ = 0u32; let mut fd_ = 0u32; diff --git a/wai/wai-rs/tests/media_decode_bounds.rs b/wai/wai-rs/tests/media_decode_bounds.rs index 3d14017e2..3be4ee27b 100644 --- a/wai/wai-rs/tests/media_decode_bounds.rs +++ b/wai/wai-rs/tests/media_decode_bounds.rs @@ -305,7 +305,7 @@ fn a_sequence_header_larger_than_the_framing_header_is_refused_before_it_allocat // pixels, so it refuses the stream's sequence header instead of allocating its // frames and leaving the size check to the decoded picture. let unit = av1_unit(256, 256, rav1e::color::ChromaSampling::Cs420, 8, [100, 128, 128]); - let e = why(av1_decode(&framing(1, 16, 16, &[unit.clone()]))); + let e = why(av1_decode(&framing(1, 16, 16, std::slice::from_ref(&unit)))); assert!(!e.contains("256×256 frame"), "the frame was decoded before it was refused: {e}"); assert!(av1_decode(&framing(1, 256, 256, &[unit])).is_ok()); }