From ba75923e6125edc24a8dec409d964d2914af1f15 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 24 Nov 2026 13:57:13 +0000 Subject: [PATCH 1/6] id: fix clippy::assert_is_empty sites in id-render tests; drop the P8.8 allows in id-core/id-caps/id-config (#803) First slice of the P8.8 sweep. The 15 firing sites in id-render's integration tests now use assert_eq!/assert_ne! per clippy's own suggestions. The assert_is_empty and chunks_exact_to_as_chunks allows (and their TODO(P8.8) comment) are removed from the id-core, id-caps and id-config lint tables so the branch verification enumerates every remaining site in those crates; further site fixes follow in this PR. The remaining tables stay allowed until the crates blocked behind #13843's error-level failures lint again (recorded on #803). --- pkgs/id/crates/id-caps/Cargo.toml | 5 ----- pkgs/id/crates/id-config/Cargo.toml | 2 -- pkgs/id/crates/id-core/Cargo.toml | 5 ----- pkgs/id/crates/id-render/tests/compose.rs | 14 ++++++++++---- pkgs/id/crates/id-render/tests/lower.rs | 18 ++++++++---------- pkgs/id/crates/id-render/tests/lower_gui.rs | 4 ++-- pkgs/id/crates/id-render/tests/lower_native.rs | 9 ++++++--- 7 files changed, 26 insertions(+), 31 deletions(-) diff --git a/pkgs/id/crates/id-caps/Cargo.toml b/pkgs/id/crates/id-caps/Cargo.toml index 45537ec4a6..69da9a9726 100644 --- a/pkgs/id/crates/id-caps/Cargo.toml +++ b/pkgs/id/crates/id-caps/Cargo.toml @@ -117,8 +117,3 @@ fn_params_excessive_bools = "allow" struct_excessive_bools = "allow" cognitive_complexity = "allow" future_not_send = "allow" -# TODO(P8.8): Clippy 1.99 fires these on about 50 `assert!(x.is_empty())` sites -# and 2 `chunks_exact` sites. Allowed until the lints review in plan step P8.8 -# (doc/2026-10-11T11-08-42Z_design_remaining_work/plan-phases.md). -assert_is_empty = "allow" -chunks_exact_to_as_chunks = "allow" diff --git a/pkgs/id/crates/id-config/Cargo.toml b/pkgs/id/crates/id-config/Cargo.toml index 4c144bcffc..d1c51bf64f 100644 --- a/pkgs/id/crates/id-config/Cargo.toml +++ b/pkgs/id/crates/id-config/Cargo.toml @@ -106,5 +106,3 @@ fn_params_excessive_bools = "allow" struct_excessive_bools = "allow" cognitive_complexity = "allow" future_not_send = "allow" -assert_is_empty = "allow" -chunks_exact_to_as_chunks = "allow" diff --git a/pkgs/id/crates/id-core/Cargo.toml b/pkgs/id/crates/id-core/Cargo.toml index 3873229ecc..f602ef2a15 100644 --- a/pkgs/id/crates/id-core/Cargo.toml +++ b/pkgs/id/crates/id-core/Cargo.toml @@ -158,8 +158,3 @@ fn_params_excessive_bools = "allow" struct_excessive_bools = "allow" cognitive_complexity = "allow" future_not_send = "allow" -# TODO(P8.8): Clippy 1.99 fires these on about 50 `assert!(x.is_empty())` sites -# and 2 `chunks_exact` sites. Allowed until the lints review in plan step P8.8 -# (doc/2026-10-11T11-08-42Z_design_remaining_work/plan-phases.md). -assert_is_empty = "allow" -chunks_exact_to_as_chunks = "allow" diff --git a/pkgs/id/crates/id-render/tests/compose.rs b/pkgs/id/crates/id-render/tests/compose.rs index 18a7cd35cb..8848321ada 100644 --- a/pkgs/id/crates/id-render/tests/compose.rs +++ b/pkgs/id/crates/id-render/tests/compose.rs @@ -385,7 +385,10 @@ fn raw_css_is_ignored_off_web_with_a_warning_decision_5854_s2_3_s6d() { // appears in the resolved IR for a non-web target. assert_eq!(button.properties.len(), 1); assert_eq!(button.properties[0].layer, WinningLayer::Assertion); - assert!(composed.report.reported_overrides.is_empty()); + assert_eq!( + composed.report.reported_overrides, + [] as [id_render::compose::ReportedOverride; 0] + ); assert!( composed .report @@ -470,10 +473,13 @@ fn target_locality_other_targets_declarations_do_not_leak_decision_5854_s2_4() { let composed = compose_document(&doc, &target("native"), &ComposeData::default()).expect("composes"); let button = find(&composed.root, BUTTON_PATH).expect("button present"); - assert!(button.properties.is_empty()); + assert_eq!(button.properties, [] as [id_render::compose::ResolvedProperty; 0]); assert_eq!(button.presentation, None); - assert!(composed.report.warnings.is_empty()); - assert!(composed.report.reported_overrides.is_empty()); + assert_eq!(composed.report.warnings, [] as [id_render::compose::CompositionWarning; 0]); + assert_eq!( + composed.report.reported_overrides, + [] as [id_render::compose::ReportedOverride; 0] + ); } #[test] diff --git a/pkgs/id/crates/id-render/tests/lower.rs b/pkgs/id/crates/id-render/tests/lower.rs index e81605e4e1..bf929d617d 100644 --- a/pkgs/id/crates/id-render/tests/lower.rs +++ b/pkgs/id/crates/id-render/tests/lower.rs @@ -177,7 +177,7 @@ fn accessibility_role_survives_lowering_decision_5855_invariant_5() { node.role, vocabulary::lookup(kind).expect("registry kind").role ); - assert!(!node.role.is_empty()); + assert_ne!(node.role, ""); } } @@ -213,7 +213,7 @@ fn mapped_roles_emit_utilities_from_decision_5851_s3() { assert!(artefact.class_set.iter().any(|c| c == class)); } assert_eq!(report.mapped.len(), 4); - assert!(report.defaulted.is_empty()); + assert_eq!(report.defaulted, [] as [id_render::lower::DefaultedAssertion; 0]); let mut sorted = artefact.class_set.clone(); sorted.sort(); assert_eq!(artefact.class_set, sorted, "class set is order-normalised"); @@ -248,13 +248,11 @@ fn density_is_mapped_without_utilities_decision_5851_s3_3() { let (artefact, report) = lower_web(&doc, &composed(vec![prop("density", "compact")])).expect("lowering succeeds"); assert_eq!(report.mapped.len(), 1); - assert!(report.mapped[0].classes.is_empty()); - assert!(report.defaulted.is_empty()); - assert!( - find(&artefact.root, "button") - .expect("button") - .classes - .is_empty() + assert_eq!(report.mapped[0].classes, [] as [std::string::String; 0]); + assert_eq!(report.defaulted, [] as [id_render::lower::DefaultedAssertion; 0]); + assert_eq!( + find(&artefact.root, "button").expect("button").classes, + [] as [std::string::String; 0] ); } @@ -276,7 +274,7 @@ fn raw_css_winner_is_carried_as_text_not_classes_decision_5851_s5() { button.raw_css, vec![("color".to_string(), "rebeccapurple".to_string())] ); - assert!(button.classes.is_empty()); + assert_eq!(button.classes, [] as [std::string::String; 0]); assert!(report.mapped.is_empty() && report.defaulted.is_empty()); } diff --git a/pkgs/id/crates/id-render/tests/lower_gui.rs b/pkgs/id/crates/id-render/tests/lower_gui.rs index 3c78e8ebb2..1e017c9175 100644 --- a/pkgs/id/crates/id-render/tests/lower_gui.rs +++ b/pkgs/id/crates/id-render/tests/lower_gui.rs @@ -175,7 +175,7 @@ fn asset_override_applies_with_per_state_assets_decision_5853_s2_2() { } assert_eq!(report.applied.len(), 1); assert_eq!(report.applied[0].kind, "asset"); - assert!(report.fallbacks.is_empty()); + assert_eq!(report.fallbacks, [] as [id_render::lower_gui::ExercisedFallback; 0]); } #[test] @@ -303,7 +303,7 @@ fn missing_asset_exercises_the_standard_fallback_decision_5853_s2_4() { } assert_eq!(report.fallbacks.len(), 1); assert!(report.fallbacks[0].warning.contains("assets/gone")); - assert!(report.applied.is_empty()); + assert_eq!(report.applied, [] as [id_render::lower_gui::AppliedOverride; 0]); } #[test] diff --git a/pkgs/id/crates/id-render/tests/lower_native.rs b/pkgs/id/crates/id-render/tests/lower_native.rs index 43df10380b..42d5359843 100644 --- a/pkgs/id/crates/id-render/tests/lower_native.rs +++ b/pkgs/id/crates/id-render/tests/lower_native.rs @@ -156,7 +156,10 @@ fn lower_emits_os_standard_controls_from_decision_5852_s2() { find(&mac.root, "form").expect("form").control, "grouped form layout" ); - assert!(mac_report.element_defaults.is_empty()); + assert_eq!( + mac_report.element_defaults, + [] as [id_render::lower_native::NativeElementDefault; 0] + ); let (windows, _) = lower_native(&doc, &composed("windows", vec![])).expect("windows lowers"); assert_eq!( @@ -266,7 +269,7 @@ fn mapped_assertions_record_platform_renderings_decision_5852_s3() { ) .expect("lowering succeeds"); assert_eq!(report.mapped.len(), 4); - assert!(report.defaulted.is_empty()); + assert_eq!(report.defaulted, [] as [id_render::lower_native::DefaultedNativeAssertion; 0]); let rendering = |property: &str| { report .mapped @@ -399,7 +402,7 @@ fn raw_css_winner_is_a_platform_default_on_native_decision_5852_a3() { theme_value: None, }; let (_, report) = lower_native(&doc, &composed("mac", vec![raw])).expect("lowering succeeds"); - assert!(report.mapped.is_empty()); + assert_eq!(report.mapped, [] as [id_render::lower_native::MappedNativeAssertion; 0]); assert_eq!(report.defaulted.len(), 1); assert!( report.defaulted[0].warning.contains("rebeccapurple"), From 0e7d66d4b3891af5f8fcea288b506ed49289b79c Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 24 Nov 2026 14:05:17 +0000 Subject: [PATCH 2/6] id: fix all enumerated assert_is_empty + chunks_exact_to_as_chunks sites in id-core/id-caps (#803) 81 assert sites converted to assert_eq!/assert_ne! with clippy's own suggested empty values (verified per-site against the override probe, fleet run 45403884689), and 5 chunks_exact call sites converted to as_chunks (id_shape, id_uri_parse, sanctions_store, transport_advertisement hex decoders + graph_term_codec test). Together with the id-render fixes this clears both 1.99 lints in every crate whose lint tables are un-allowed in this PR and whose targets compile; id-store's lib and id-caps' lib-test remain blocked by the pre-existing error-level failures tracked on #13843. --- pkgs/id/crates/id-caps/src/cap_notice.rs | 2 +- pkgs/id/crates/id-caps/src/declaration.rs | 10 ++-- pkgs/id/crates/id-caps/src/library_attach.rs | 24 ++------- .../id/crates/id-caps/src/library_manifest.rs | 2 +- .../crates/id-caps/src/library_resolution.rs | 10 +++- pkgs/id/crates/id-caps/src/role_config.rs | 2 +- pkgs/id/crates/id-caps/src/world_caps.rs | 2 +- pkgs/id/crates/id-caps/src/world_manifest.rs | 22 ++++---- pkgs/id/crates/id-core/src/abuse.rs | 15 ++++-- pkgs/id/crates/id-core/src/access.rs | 4 +- pkgs/id/crates/id-core/src/append_list.rs | 28 +++++----- pkgs/id/crates/id-core/src/id_shape.rs | 2 +- pkgs/id/crates/id-core/src/id_uri.rs | 2 +- pkgs/id/crates/id-core/src/id_uri_parse.rs | 2 +- .../id/crates/id-core/src/membership/layer.rs | 2 +- pkgs/id/crates/id-core/src/sanctions.rs | 2 +- pkgs/id/crates/id-core/src/sanctions_store.rs | 2 +- .../id-core/src/transport_advertisement.rs | 2 +- pkgs/id/crates/id-core/src/tuple.rs | 2 +- pkgs/id/crates/id-core/src/waiting.rs | 54 +++++++++---------- .../id-core/tests/cross_signing_challenge.rs | 2 +- .../crates/id-core/tests/delegation_model.rs | 2 +- .../crates/id-core/tests/graph_term_codec.rs | 4 +- .../id-core/tests/social_graph_traversal.rs | 4 +- .../id-core/tests/stream_lifecycle_model.rs | 2 +- pkgs/id/crates/id-core/tests/succeeds_dag.rs | 10 ++-- pkgs/id/crates/id-core/tests/swarm_bench.rs | 2 +- 27 files changed, 107 insertions(+), 110 deletions(-) diff --git a/pkgs/id/crates/id-caps/src/cap_notice.rs b/pkgs/id/crates/id-caps/src/cap_notice.rs index 4b17bf3595..c8b1d7e309 100644 --- a/pkgs/id/crates/id-caps/src/cap_notice.rs +++ b/pkgs/id/crates/id-caps/src/cap_notice.rs @@ -518,7 +518,7 @@ mod tests { assert!(notice.should_prompt()); assert!(notice.uncomputable); assert_eq!(notice.client_side.len(), 1); - assert!(notice.server_side.is_empty()); + assert_eq!(notice.server_side, [] as [cap_notice::NoticeLine; 0]); assert_eq!(notice.client_side[0].class, CLASS_UNKNOWN); assert_eq!( notice.client_side[0].message, diff --git a/pkgs/id/crates/id-caps/src/declaration.rs b/pkgs/id/crates/id-caps/src/declaration.rs index 1cf6f350e3..535b37a675 100644 --- a/pkgs/id/crates/id-caps/src/declaration.rs +++ b/pkgs/id/crates/id-caps/src/declaration.rs @@ -1250,7 +1250,7 @@ mod tests { let mut registry = DeclarationRegistry::new(); let digest = registry.file_signed(&signed, 200).expect("filing succeeds"); // Filed is discoverable by nobody and grantable by nobody (D6). - assert!(registry.declaration_view().is_empty()); + assert_eq!(registry.declaration_view(), [] as [declaration::DeclarationCard; 0]); assert!(registry.resolve_tuple(&identity, "echo", 1).is_none()); let admission = registry .admit(&digest, "registry-1", 210) @@ -1349,7 +1349,7 @@ mod tests { registry.file_signed(&forged, 200), Err(DeclarationRefusal::BadSignature) ); - assert!(registry.declaration_view().is_empty()); + assert_eq!(registry.declaration_view(), [] as [declaration::DeclarationCard; 0]); // A tampered field after signing also fails verification. let mut tampered = SignedManifest::sign(declaration(&provider, "forged.provider", 1), &provider); @@ -1469,7 +1469,7 @@ mod tests { assert_eq!(registry.declaration_view().len(), 1); let genuine = SignedWithdrawal::sign(identity, "main".to_owned(), 1, 1, &provider); registry.withdraw(&genuine).expect("withdrawal applies"); - assert!(registry.declaration_view().is_empty()); + assert_eq!(registry.declaration_view(), [] as [declaration::DeclarationCard; 0]); assert_eq!( registry .fetch_by_digest(&digest) @@ -1495,7 +1495,7 @@ mod tests { registry.tick(9_999); assert_eq!(registry.declaration_view().len(), 1); registry.tick(10_000); - assert!(registry.declaration_view().is_empty()); + assert_eq!(registry.declaration_view(), [] as [declaration::DeclarationCard; 0]); assert_eq!( registry .fetch_by_digest(&digest) @@ -1562,7 +1562,7 @@ mod tests { .expect("admitted"); registry.mark_live(&digest).expect("live"); registry.suspend(&digest).expect("suspends"); - assert!(registry.declaration_view().is_empty()); + assert_eq!(registry.declaration_view(), [] as [declaration::DeclarationCard; 0]); registry.resume(&digest).expect("resumes"); let view = registry.declaration_view(); assert_eq!(view.len(), 1); diff --git a/pkgs/id/crates/id-caps/src/library_attach.rs b/pkgs/id/crates/id-caps/src/library_attach.rs index 9060d9a279..3e187cc682 100644 --- a/pkgs/id/crates/id-caps/src/library_attach.rs +++ b/pkgs/id/crates/id-caps/src/library_attach.rs @@ -1138,11 +1138,7 @@ mod tests { registry.get_state("entity-1", "lib-hash-1"), Some(b"save-data".as_slice()) ); - assert!( - registry - .inert_entries("entity-1", "lib-hash-1", 1) - .is_empty() - ); + assert_eq!(registry.inert_entries("entity-1", "lib-hash-1", 1), []); } #[test] @@ -1175,11 +1171,7 @@ mod tests { registry.drop_inert("owner-1", "entity-1", "lib-hash-1", 1), Ok(1) ); - assert!( - registry - .inert_entries("entity-1", "lib-hash-1", 1) - .is_empty() - ); + assert_eq!(registry.inert_entries("entity-1", "lib-hash-1", 1), []); // After the drop, a reattach revives nothing. let _ = attached(&mut registry, offer("1.0.0", &["chat.say"])); assert_eq!(registry.get_state("entity-1", "lib-hash-1"), None); @@ -1226,11 +1218,7 @@ mod tests { registry.get_state("entity-1", "lib-hash-1"), Some(b"v1-state".as_slice()) ); - assert!( - registry - .inert_entries("entity-1", "lib-hash-1", 1) - .is_empty() - ); + assert_eq!(registry.inert_entries("entity-1", "lib-hash-1", 1), []); } #[test] @@ -1260,11 +1248,7 @@ mod tests { registry.get_state("entity-1", "lib-hash-1"), Some(b"v1-state".as_slice()) ); - assert!( - registry - .inert_entries("entity-1", "lib-hash-1", 1) - .is_empty() - ); + assert_eq!(registry.inert_entries("entity-1", "lib-hash-1", 1), []); } #[test] diff --git a/pkgs/id/crates/id-caps/src/library_manifest.rs b/pkgs/id/crates/id-caps/src/library_manifest.rs index 693057520e..a139571340 100644 --- a/pkgs/id/crates/id-caps/src/library_manifest.rs +++ b/pkgs/id/crates/id-caps/src/library_manifest.rs @@ -725,7 +725,7 @@ library "pure-lib" version="0.1.0" { "#; let m = LibraryManifest::parse(text).unwrap(); assert!(m.is_pure()); - assert!(m.requirements.is_empty()); + assert_eq!(m.requirements, [] as [library_manifest::PlatformRequirement; 0]); } #[test] diff --git a/pkgs/id/crates/id-caps/src/library_resolution.rs b/pkgs/id/crates/id-caps/src/library_resolution.rs index 0c957047a5..6f41bc706b 100644 --- a/pkgs/id/crates/id-caps/src/library_resolution.rs +++ b/pkgs/id/crates/id-caps/src/library_resolution.rs @@ -460,7 +460,10 @@ mod tests { } other => panic!("expected a cycle refusal, got {other:?}"), } - assert!(record.transitive_requirements.is_empty()); + assert_eq!( + record.transitive_requirements, + [] as [library_manifest::PlatformRequirement; 0] + ); } /// Oracle (ยง1): a library that depends on itself is the smallest @@ -538,7 +541,10 @@ mod tests { registry.add(manifest("leaf", "h-leaf", &[]), &[]); let record = resolve_import(®istry, &request("h-root"), None); assert_eq!(record.outcome, ResolutionOutcome::Resolved); - assert!(record.transitive_requirements.is_empty()); + assert_eq!( + record.transitive_requirements, + [] as [library_manifest::PlatformRequirement; 0] + ); assert!(!record.declared_only); } diff --git a/pkgs/id/crates/id-caps/src/role_config.rs b/pkgs/id/crates/id-caps/src/role_config.rs index ce3e33e053..0f3b6f49fa 100644 --- a/pkgs/id/crates/id-caps/src/role_config.rs +++ b/pkgs/id/crates/id-caps/src/role_config.rs @@ -681,7 +681,7 @@ mod tests { let revoked = registry.revoke("participant", agent(9), OWNER, NOW + 3); assert_eq!(revoked.decision, Ok(())); assert_eq!(revoked.event.kind, EVENT_ROLE_REVOKE); - assert!(registry.list_grants().is_empty()); + assert_eq!(registry.list_grants(), [] as [&role_config::RoleGrant; 0]); // Revoking a grant that is not held is refused and audited. let missing = registry.revoke("participant", agent(9), OWNER, NOW + 4); diff --git a/pkgs/id/crates/id-caps/src/world_caps.rs b/pkgs/id/crates/id-caps/src/world_caps.rs index 402400f7b2..c4b84776d7 100644 --- a/pkgs/id/crates/id-caps/src/world_caps.rs +++ b/pkgs/id/crates/id-caps/src/world_caps.rs @@ -3038,7 +3038,7 @@ mod tests { records.push(entry.clone()); used += entry_bytes; } - assert!(!records.is_empty()); + assert_ne!(records, [] as [serde_json::Value; 0]); // 256 raw key bytes (128 backslash+quote pairs), the longest a // record key may be, and the worst case for JSON escaping. let next_after: String = (0..128) diff --git a/pkgs/id/crates/id-caps/src/world_manifest.rs b/pkgs/id/crates/id-caps/src/world_manifest.rs index 2b9bb51051..b85df4ed15 100644 --- a/pkgs/id/crates/id-caps/src/world_manifest.rs +++ b/pkgs/id/crates/id-caps/src/world_manifest.rs @@ -745,7 +745,7 @@ native_memory_bytes = 16777216", fn an_empty_manifest_drifts_nothing() { let manifest = WorldManifest::default(); // A default (empty) manifest leaves a default (empty) world alone. - assert!(plan(&manifest, &WorldState::default()).is_empty()); + assert_eq!(plan(&manifest, &WorldState::default()), [] as [world_manifest::ApplyStep; 0]); // And it leaves a fully populated world alone too (#817): every field // is unspecified, so nothing is revoked, widened, or cancelled. let state = WorldState { @@ -756,7 +756,7 @@ native_memory_bytes = 16777216", schedules: BTreeMap::from([("round".to_owned(), 5)]), ..WorldState::default() }; - assert!(plan(&manifest, &state).is_empty()); + assert_eq!(plan(&manifest, &state), [] as [world_manifest::ApplyStep; 0]); } #[test] @@ -865,7 +865,7 @@ native_memory_bytes = 16777216", // None โ€” and None means the default ceiling, so nothing drifts. state.ceiling = fold_reported_ceiling(state.ceiling.clone().unwrap()); assert_eq!(state.ceiling, None); - assert!(plan(&manifest, &state).is_empty()); + assert_eq!(plan(&manifest, &state), [] as [world_manifest::ApplyStep; 0]); // A host report of exactly the default list (never folded by hand) // also converges from the start. let reported = WorldState { @@ -876,7 +876,7 @@ native_memory_bytes = 16777216", ceiling: fold_reported_ceiling(reported.ceiling.clone().unwrap()), ..reported }; - assert!(plan(&manifest, &folded).is_empty()); + assert_eq!(plan(&manifest, &folded), [] as [world_manifest::ApplyStep; 0]); } #[test] @@ -911,7 +911,7 @@ native_memory_bytes = 16777216", }] ); let omitted = WorldManifest::default(); - assert!(plan(&omitted, ¤t).is_empty()); + assert_eq!(plan(&omitted, ¤t), [] as [world_manifest::ApplyStep; 0]); } #[test] @@ -950,11 +950,11 @@ native_memory_bytes = 16777216", let manifest = parse(manifest_toml()).unwrap(); let mut state = WorldState::default(); let steps = plan(&manifest, &state); - assert!(!steps.is_empty()); + assert_ne!(steps, [] as [world_manifest::ApplyStep; 0]); let changed = apply(&steps, &mut state).unwrap(); assert_eq!(changed, steps.len()); // A second plan against the reconciled state is empty. - assert!(plan(&manifest, &state).is_empty()); + assert_eq!(plan(&manifest, &state), [] as [world_manifest::ApplyStep; 0]); } #[test] @@ -1186,7 +1186,7 @@ native_memory_bytes = 16777216", // Applying the step reconciles: a second plan is empty. let mut applied = state.clone(); apply(&steps, &mut applied).unwrap(); - assert!(plan(&manifest, &applied).is_empty()); + assert_eq!(plan(&manifest, &applied), [] as [world_manifest::ApplyStep; 0]); } #[test] @@ -1237,12 +1237,12 @@ native_memory_bytes = 16777216", // #1519 ruling: no installed program and none desired -- there is // nothing whose seed could change. let manifest = parse("seed = 99").unwrap(); - assert!(plan(&manifest, &WorldState::default()).is_empty()); + assert_eq!(plan(&manifest, &WorldState::default()), [] as [world_manifest::ApplyStep; 0]); let state = WorldState { seed: 7, ..WorldState::default() }; - assert!(plan(&manifest, &state).is_empty()); + assert_eq!(plan(&manifest, &state), [] as [world_manifest::ApplyStep; 0]); } #[test] @@ -1254,7 +1254,7 @@ native_memory_bytes = 16777216", ceiling: Some(vec!["time.now".to_owned(), "chat.say".to_owned()]), ..WorldState::default() }; - assert!(plan(&manifest, &state).is_empty()); + assert_eq!(plan(&manifest, &state), [] as [world_manifest::ApplyStep; 0]); } #[test] diff --git a/pkgs/id/crates/id-core/src/abuse.rs b/pkgs/id/crates/id-core/src/abuse.rs index c409986b56..a9aa2b104f 100644 --- a/pkgs/id/crates/id-core/src/abuse.rs +++ b/pkgs/id/crates/id-core/src/abuse.rs @@ -1823,7 +1823,10 @@ mod tests { #[test] fn directional_snapshot_is_empty_without_traffic() { let eval = evaluator(); - assert!(eval.counters().snapshot_directional().is_empty()); + assert_eq!( + eval.counters().snapshot_directional(), + [] as [(([u8; 32], [u8; 32]), abuse::DirectionalCounters); 0] + ); } } @@ -1881,7 +1884,10 @@ mod budget_tests { policy.per_ip, vec![BudgetLimit::bytes(3_600_000, 250 * mib)] ); - assert!(policy.counterparty_overrides.is_empty()); + assert_eq!( + policy.counterparty_overrides, + [] as [([u8; 32], std::vec::Vec); 0] + ); } #[test] @@ -2097,6 +2103,9 @@ mod budget_tests { 0, ) .expect("unconfigured budgets never refuse"); - assert!(eval.budget_usage(0).is_empty()); + assert_eq!( + eval.budget_usage(0), + [] as [(abuse::BudgetScope, abuse::BudgetLimit, abuse::BudgetUsage); 0] + ); } } diff --git a/pkgs/id/crates/id-core/src/access.rs b/pkgs/id/crates/id-core/src/access.rs index d406799795..37a7870a60 100644 --- a/pkgs/id/crates/id-core/src/access.rs +++ b/pkgs/id/crates/id-core/src/access.rs @@ -242,7 +242,7 @@ mod tests { #[test] fn load_allowed_nodes_missing_file_is_empty() { let dir = tempfile::TempDir::new().unwrap(); - assert!(load_allowed_nodes(dir.path()).is_empty()); + assert_eq!(load_allowed_nodes(dir.path()), [] as [iroh_base::PublicKey; 0]); } #[test] @@ -303,7 +303,7 @@ mod tests { fn load_allowed_nodes_missing_file_is_empty_and_silent() { let dir = tempfile::TempDir::new().unwrap(); let (loaded, lines) = captured_load(dir.path()); - assert!(loaded.is_empty()); + assert_eq!(loaded, [] as [iroh_base::PublicKey; 0]); assert!(lines.is_empty(), "missing file must not warn: {lines:?}"); } diff --git a/pkgs/id/crates/id-core/src/append_list.rs b/pkgs/id/crates/id-core/src/append_list.rs index 499493c9cb..c6657f7a4d 100644 --- a/pkgs/id/crates/id-core/src/append_list.rs +++ b/pkgs/id/crates/id-core/src/append_list.rs @@ -597,12 +597,10 @@ mod tests { server.submit(ATTR, b"hello", &hash, &public, &signature), Err(Refusal::NotOpened) ); - assert!(server.read(ATTR, None, None).unwrap().is_empty()); - assert!( - server - .pending(ATTR, &key(1).verifying_key()) - .unwrap() - .is_empty() + assert_eq!(server.read(ATTR, None, None).unwrap(), []); + assert_eq!( + server.pending(ATTR, &key(1).verifying_key()).unwrap(), + [] as [&append_list::PendingSubmission; 0] ); assert_eq!(server.own_state(ATTR, &public, &hash), Ok(None)); } @@ -619,13 +617,11 @@ mod tests { Err(Refusal::NotOpened) ); server.open(ATTR, &key(1).verifying_key()).unwrap(); - assert!( - server - .pending(ATTR, &key(1).verifying_key()) - .unwrap() - .is_empty() + assert_eq!( + server.pending(ATTR, &key(1).verifying_key()).unwrap(), + [] as [&append_list::PendingSubmission; 0] ); - assert!(server.read(ATTR, None, None).unwrap().is_empty()); + assert_eq!(server.read(ATTR, None, None).unwrap(), []); } #[test] @@ -666,7 +662,7 @@ mod tests { fn pending_is_never_read_as_a_list_entry_and_only_approvers_see_the_queue() { let mut server = opened_server(); submit(&mut server, &key(5), b"pending").unwrap(); - assert!(server.read(ATTR, None, None).unwrap().is_empty()); + assert_eq!(server.read(ATTR, None, None).unwrap(), []); assert_eq!( server.pending(ATTR, &key(1).verifying_key()).unwrap().len(), 1 @@ -745,7 +741,7 @@ mod tests { server.approve(ATTR, &owner, id), Err(Refusal::NoSuchSubmission) ); - assert!(server.read(ATTR, None, None).unwrap().is_empty()); + assert_eq!(server.read(ATTR, None, None).unwrap(), []); } #[test] @@ -823,8 +819,8 @@ mod tests { assert_eq!(seqs(None, Some(2)), vec![0, 1]); assert_eq!(seqs(Some(1), None), vec![2, 3]); assert_eq!(seqs(Some(1), Some(1)), vec![2]); - assert!(seqs(Some(3), None).is_empty()); - assert!(seqs(Some(u64::MAX), None).is_empty()); + assert_eq!(seqs(Some(3), None), [] as [u64; 0]); + assert_eq!(seqs(Some(u64::MAX), None), [] as [u64; 0]); } #[test] diff --git a/pkgs/id/crates/id-core/src/id_shape.rs b/pkgs/id/crates/id-core/src/id_shape.rs index 7f19dc54c2..fa1138a778 100644 --- a/pkgs/id/crates/id-core/src/id_shape.rs +++ b/pkgs/id/crates/id-core/src/id_shape.rs @@ -888,7 +888,7 @@ fn hex_decode(text: &str, what: &str) -> Result, IdShapeError> { } let mut out = Vec::with_capacity(text.len() / 2); let bytes = text.as_bytes(); - for pair in bytes.chunks_exact(2) { + for pair in bytes.as_chunks::<2>().0 { let hi = hex_value(pair[0], what)?; let lo = hex_value(pair[1], what)?; out.push((hi << 4) | lo); diff --git a/pkgs/id/crates/id-core/src/id_uri.rs b/pkgs/id/crates/id-core/src/id_uri.rs index 97747e146a..b0d9ec2b19 100644 --- a/pkgs/id/crates/id-core/src/id_uri.rs +++ b/pkgs/id/crates/id-core/src/id_uri.rs @@ -571,7 +571,7 @@ mod tests { assert_ne!(without, with); assert_eq!(with.segments(), ["a", ""]); assert_eq!(with.to_string(), "id://h/ns/a/"); - assert!(IdUri::parse("id://h/ns").unwrap().segments().is_empty()); + assert_eq!(IdUri::parse("id://h/ns").unwrap().segments(), []); assert_eq!(IdUri::parse("id://h/ns/").unwrap().segments(), [""]); } diff --git a/pkgs/id/crates/id-core/src/id_uri_parse.rs b/pkgs/id/crates/id-core/src/id_uri_parse.rs index b659497653..617ff2189b 100644 --- a/pkgs/id/crates/id-core/src/id_uri_parse.rs +++ b/pkgs/id/crates/id-core/src/id_uri_parse.rs @@ -359,7 +359,7 @@ fn parse_content_token(token: &str) -> Result { return Err(UriParseError::InvalidDigestText); } let mut digest = [0_u8; DIGEST_BYTES]; - for (slot, pair) in digest.iter_mut().zip(text.chunks_exact(2)) { + for (slot, pair) in digest.iter_mut().zip(text.as_chunks::<2>().0) { let nibble = |byte: u8| match byte { b'0'..=b'9' => Some(byte - b'0'), b'a'..=b'f' => Some(byte - b'a' + 10), diff --git a/pkgs/id/crates/id-core/src/membership/layer.rs b/pkgs/id/crates/id-core/src/membership/layer.rs index 440ebeed7c..cbedb95f44 100644 --- a/pkgs/id/crates/id-core/src/membership/layer.rs +++ b/pkgs/id/crates/id-core/src/membership/layer.rs @@ -943,7 +943,7 @@ mod tests { member_keys(&layer, 30), vec![AuthId::Key(key(1)), AuthId::Key(key(2))] ); - assert!(layer.members(id(10)).is_empty()); + assert_eq!(layer.members(id(10)), [] as [(membership::AuthId, p2panda_auth::Access); 0]); } #[test] diff --git a/pkgs/id/crates/id-core/src/sanctions.rs b/pkgs/id/crates/id-core/src/sanctions.rs index e8434de3b6..1c6737938f 100644 --- a/pkgs/id/crates/id-core/src/sanctions.rs +++ b/pkgs/id/crates/id-core/src/sanctions.rs @@ -648,7 +648,7 @@ mod tests { let v1 = list(1, vec![]); let v2 = list(2, vec![SanctionsEntry::Country { code: "CU".into() }]); let before = find_matches(&v1, Some("CU"), &BTreeSet::new(), &BTreeSet::new()); - assert!(before.is_empty()); + assert_eq!(before, [] as [sanctions::SubjectMatch; 0]); let after = find_matches(&v2, Some("CU"), &BTreeSet::new(), &BTreeSet::new()); let d = evaluate( &boundary(), diff --git a/pkgs/id/crates/id-core/src/sanctions_store.rs b/pkgs/id/crates/id-core/src/sanctions_store.rs index 4cc566bddd..9be46a421b 100644 --- a/pkgs/id/crates/id-core/src/sanctions_store.rs +++ b/pkgs/id/crates/id-core/src/sanctions_store.rs @@ -269,7 +269,7 @@ fn decode_signature(id: &str, version: u64, hex: &str) -> Result().0.iter().enumerate() { let hi = char::from(pair[0]).to_digit(16).ok_or_else(&malformed)?; let lo = char::from(pair[1]).to_digit(16).ok_or_else(&malformed)?; bytes[i] = u8::try_from(hi * 16 + lo).map_err(|_| malformed())?; diff --git a/pkgs/id/crates/id-core/src/transport_advertisement.rs b/pkgs/id/crates/id-core/src/transport_advertisement.rs index 7631b9c453..e63ea16e03 100644 --- a/pkgs/id/crates/id-core/src/transport_advertisement.rs +++ b/pkgs/id/crates/id-core/src/transport_advertisement.rs @@ -146,7 +146,7 @@ fn hex_decode(s: &str) -> Option> { _ => None, } }; - for pair in bytes.chunks_exact(2) { + for pair in bytes.as_chunks::<2>().0 { out.push((nibble(pair[0])? << 4) | nibble(pair[1])?); } Some(out) diff --git a/pkgs/id/crates/id-core/src/tuple.rs b/pkgs/id/crates/id-core/src/tuple.rs index fb45c276b4..c43937d2ad 100644 --- a/pkgs/id/crates/id-core/src/tuple.rs +++ b/pkgs/id/crates/id-core/src/tuple.rs @@ -1175,7 +1175,7 @@ mod tests { #[test] fn test_decode_empty() { let vals = decode(&[]).unwrap(); - assert!(vals.is_empty()); + assert_eq!(vals, [] as [tuple::TupleValue; 0]); } #[test] diff --git a/pkgs/id/crates/id-core/src/waiting.rs b/pkgs/id/crates/id-core/src/waiting.rs index dc115d7c7d..8aafe908f8 100644 --- a/pkgs/id/crates/id-core/src/waiting.rs +++ b/pkgs/id/crates/id-core/src/waiting.rs @@ -634,7 +634,7 @@ mod tests { pool.insert(author(1), 3, [10], "c", 0), Err(WaitRefusal::AuthorFull) ); - assert!(pool.expire(999).is_empty()); + assert_eq!(pool.expire(999), [] as [([u8; 32], &str); 0]); assert_eq!(pool.expire(1_000).len(), 2); } @@ -669,7 +669,7 @@ mod tests { fn test_expiry_is_inclusive_at_max_age_and_exclusive_one_ms_before() { let mut pool = pool(); pool.insert(author(1), 1, [9], "e1", 1_000).unwrap(); - assert!(pool.expire(1_000 + WEEK_MS - 1).is_empty()); + assert_eq!(pool.expire(1_000 + WEEK_MS - 1), [] as [([u8; 32], &str); 0]); assert_eq!(pool.len(), 1); assert_eq!(pool.expire(1_000 + WEEK_MS), vec![(author(1), "e1")]); assert_eq!(pool.waiting_count(author(1)), 0); @@ -681,7 +681,7 @@ mod tests { fn test_an_expired_event_is_not_released_by_its_dependency() { let mut pool = pool(); pool.insert(author(1), 1, [9], "e1", 0).unwrap(); - assert!(pool.arrived(9, WEEK_MS).is_empty()); + assert_eq!(pool.arrived(9, WEEK_MS), [] as [&str; 0]); assert_eq!(pool.expire(WEEK_MS), vec![(author(1), "e1")]); } @@ -711,13 +711,13 @@ mod tests { fn test_an_event_with_two_deps_waits_for_both() { let mut pool = pool(); pool.insert(author(1), 1, [10, 11], "e", 0).unwrap(); - assert!(pool.arrived(10, 0).is_empty()); + assert_eq!(pool.arrived(10, 0), [] as [&str; 0]); assert_eq!(pool.waiting_count(author(1)), 1); assert_eq!(pool.arrived(11, 0), vec!["e"]); assert_eq!(pool.waiting_count(author(1)), 0); pool.insert(author(1), 2, [20, 21], "f", 0).unwrap(); - assert!(pool.arrived(21, 0).is_empty()); + assert_eq!(pool.arrived(21, 0), [] as [&str; 0]); assert_eq!(pool.arrived(20, 0), vec!["f"]); } @@ -736,7 +736,7 @@ mod tests { assert_eq!(pool.take_ready(), vec!["ready"]); assert_eq!(pool.waiting_count(author(1)), 0); assert!(pool.is_empty()); - assert!(pool.take_ready().is_empty()); + assert_eq!(pool.take_ready(), [] as [&str; 0]); } #[test] @@ -766,7 +766,7 @@ mod tests { let mut pool = pool(); pool.arrived(10, 0); pool.insert(author(1), 1, [10, 11], "e", 0).unwrap(); - assert!(pool.take_ready().is_empty()); + assert_eq!(pool.take_ready(), [] as [&str; 0]); assert_eq!(pool.arrived(11, 0), vec!["e"]); } @@ -780,7 +780,7 @@ mod tests { pool.arrived(1, 0); pool.insert(author(1), 1, [10], "again", 0).unwrap(); - assert!(pool.take_ready().is_empty()); + assert_eq!(pool.take_ready(), [] as [&str; 0]); assert!(pool.is_empty()); } @@ -813,9 +813,9 @@ mod tests { fn test_arrival_of_a_held_event_drops_the_held_copy_without_releasing_it() { let mut pool = pool(); pool.insert(author(1), 1, [10], "held", 0).unwrap(); - assert!(pool.arrived(1, 0).is_empty()); + assert_eq!(pool.arrived(1, 0), [] as [&str; 0]); assert_eq!(pool.waiting_count(author(1)), 0); - assert!(pool.arrived(10, 0).is_empty()); + assert_eq!(pool.arrived(10, 0), [] as [&str; 0]); } #[test] @@ -826,15 +826,15 @@ mod tests { let mut pool = pool(); pool.insert(author(1), 1, [10], "ready-after-dep", 0) .unwrap(); - assert!(pool.arrived(1, 0).is_empty()); + assert_eq!(pool.arrived(1, 0), [] as [&str; 0]); assert!( pool.take_ready().is_empty(), "a ready copy the pool has applied is not handed out again" ); pool.insert(author(1), 2, [], "ready-at-once", 0).unwrap(); - assert!(pool.arrived(2, 0).is_empty()); - assert!(pool.take_ready().is_empty()); + assert_eq!(pool.arrived(2, 0), [] as [&str; 0]); + assert_eq!(pool.take_ready(), [] as [&str; 0]); } #[test] @@ -843,7 +843,7 @@ mod tests { pool.insert(author(1), 1, [], "a", 0).unwrap(); pool.insert(author(1), 2, [], "b", 0).unwrap(); pool.insert(author(1), 3, [], "c", 0).unwrap(); - assert!(pool.arrived(2, 0).is_empty()); + assert_eq!(pool.arrived(2, 0), [] as [&str; 0]); assert_eq!( pool.take_ready(), vec!["a", "c"], @@ -884,7 +884,7 @@ mod tests { ); assert!(pool.contains(&1)); assert_eq!(pool.waiting_count(author(1)), 1); - assert!(pool.expire(500 + WEEK_MS - 1).is_empty()); + assert_eq!(pool.expire(500 + WEEK_MS - 1), [] as [([u8; 32], &str); 0]); assert_eq!(pool.expire(500 + WEEK_MS), vec![(author(1), "parked")]); } @@ -986,8 +986,8 @@ mod tests { pool.restore(author(1), 1, [10], "stale", 0).unwrap(); assert!(!pool.contains(&1)); assert!(pool.is_empty()); - assert!(pool.arrived(10, 0).is_empty()); - assert!(pool.take_ready().is_empty()); + assert_eq!(pool.arrived(10, 0), [] as [&str; 0]); + assert_eq!(pool.take_ready(), [] as [&str; 0]); assert!(pool.is_empty()); } @@ -1006,7 +1006,7 @@ mod tests { pool.take_ready().is_empty(), "the ready event is taken once" ); - assert!(pool.arrived(10, 0).is_empty()); + assert_eq!(pool.arrived(10, 0), [] as [&str; 0]); assert!(pool.is_empty()); } @@ -1021,8 +1021,8 @@ mod tests { .unwrap(); assert!(pool.contains(&7)); assert_eq!(pool.waiting_count(author(1)), 1); - assert!(pool.take_ready().is_empty()); - assert!(pool.arrived(9, 0).is_empty()); + assert_eq!(pool.take_ready(), [] as [&str; 0]); + assert_eq!(pool.arrived(9, 0), [] as [&str; 0]); assert!( pool.contains(&7), "no arrival releases a held-for-good copy" @@ -1043,7 +1043,7 @@ mod tests { // ...but the key was not recorded: an event depending on it still // waits, and the key itself is not treated as a duplicate (#1730). pool.insert(author, 11, [20], "b", 0).unwrap(); - assert!(pool.take_ready().is_empty()); + assert_eq!(pool.take_ready(), [] as [&str; 0]); assert_eq!(pool.len(), 1); pool.insert(author, 20, [], "c", 0).unwrap(); assert_eq!(pool.take_ready(), vec!["c"]); @@ -1054,7 +1054,7 @@ mod tests { let mut pool: WaitingPool = WaitingPool::new(WaitingLimits::default()); let author = [7u8; 32]; pool.insert(author, 10, [20], "a", 0).unwrap(); - assert!(pool.release(10, 0).is_empty()); + assert_eq!(pool.release(10, 0), [] as [&str; 0]); assert!(pool.is_empty()); } @@ -1072,17 +1072,17 @@ mod tests { // both re-inserts are duplicates. pool.insert(author(1), 7, [], "a-again", 0).unwrap(); pool.insert(author(1), 7, [9], "a-held", 0).unwrap(); - assert!(pool.take_ready().is_empty()); + assert_eq!(pool.take_ready(), [] as [&str; 0]); assert!(pool.is_empty(), "no second copy is held either"); // Arrival closes the window; the arrived guard takes over. - assert!(pool.arrived(7, 0).is_empty()); + assert_eq!(pool.arrived(7, 0), [] as [&str; 0]); pool.insert(author(1), 7, [], "a-third", 0).unwrap(); - assert!(pool.take_ready().is_empty()); + assert_eq!(pool.take_ready(), [] as [&str; 0]); // A released waiter's key is handed out the same way. pool.insert(author(1), 10, [20], "waiter", 0).unwrap(); assert_eq!(pool.arrived(20, 0), vec!["waiter"]); pool.insert(author(1), 10, [], "waiter-again", 0).unwrap(); - assert!(pool.take_ready().is_empty()); + assert_eq!(pool.take_ready(), [] as [&str; 0]); // But the owner re-holding a handed-out event through // restore (the event store's settle path) is a decision // about the in-flight copy, not a duplicate arrival. @@ -1096,7 +1096,7 @@ mod tests { pool.insert(author(1), 11, [], "dropped", 0).unwrap(); assert_eq!(pool.take_ready(), vec!["dropped"]); pool.insert(author(1), 11, [], "dropped-again", 0).unwrap(); - assert!(pool.take_ready().is_empty()); + assert_eq!(pool.take_ready(), [] as [&str; 0]); pool.forget(&11); pool.insert(author(1), 11, [], "dropped-again", 0).unwrap(); assert_eq!(pool.take_ready(), vec!["dropped-again"]); diff --git a/pkgs/id/crates/id-core/tests/cross_signing_challenge.rs b/pkgs/id/crates/id-core/tests/cross_signing_challenge.rs index 725a8ee747..c9078b92f9 100644 --- a/pkgs/id/crates/id-core/tests/cross_signing_challenge.rs +++ b/pkgs/id/crates/id-core/tests/cross_signing_challenge.rs @@ -545,7 +545,7 @@ fn error_classes_are_stable() { for (error, class) in all { assert_eq!(error.class(), class); assert!(seen.insert(class)); - assert!(!error.to_string().is_empty()); + assert_ne!(error.to_string(), ""); } } diff --git a/pkgs/id/crates/id-core/tests/delegation_model.rs b/pkgs/id/crates/id-core/tests/delegation_model.rs index fe5df50158..a20f4de3ae 100644 --- a/pkgs/id/crates/id-core/tests/delegation_model.rs +++ b/pkgs/id/crates/id-core/tests/delegation_model.rs @@ -848,7 +848,7 @@ fn error_classes_are_stable() { for (error, class) in all { assert_eq!(error.class(), class); assert!(seen.insert(class)); - assert!(!error.to_string().is_empty()); + assert_ne!(error.to_string(), ""); } } diff --git a/pkgs/id/crates/id-core/tests/graph_term_codec.rs b/pkgs/id/crates/id-core/tests/graph_term_codec.rs index 06eedfb9a6..54c95018d4 100644 --- a/pkgs/id/crates/id-core/tests/graph_term_codec.rs +++ b/pkgs/id/crates/id-core/tests/graph_term_codec.rs @@ -385,7 +385,9 @@ proptest! { graph in any::<[u8; 32]>(), ) { let triples: Vec = terms - .chunks_exact(3) + .as_chunks::<3>() + .0 + .iter() .map(|t| Triple::new(t[0].clone(), t[1].clone(), t[2].clone())) .collect(); let record = GraphRecord::new(LogicalGraphId::new(graph), triples); diff --git a/pkgs/id/crates/id-core/tests/social_graph_traversal.rs b/pkgs/id/crates/id-core/tests/social_graph_traversal.rs index 9d02a5a305..b13da8d751 100644 --- a/pkgs/id/crates/id-core/tests/social_graph_traversal.rs +++ b/pkgs/id/crates/id-core/tests/social_graph_traversal.rs @@ -323,7 +323,7 @@ fn missing_root_is_an_empty_complete_traversal() { let objects = vec![obj(1, SocialObjectKind::Topic, None)]; let traversal = traverse(&objects, &oid(9), &TraversalProfile::default(), |_| true); assert!(traversal.complete); - assert!(traversal.entries.is_empty()); + assert_eq!(traversal.entries, [] as [id_core::graph::social::TraversalEntry; 0]); } fn scope() -> FeedScope { @@ -411,7 +411,7 @@ fn since_and_before_page_the_pinned_snapshot() { .map(|entry| entry.entry_id.clone()) .collect(); assert_eq!(older, vec!["a1", "b1", "a2"]); - assert!(ledger.since(&head).unwrap().is_empty()); + assert_eq!(ledger.since(&head).unwrap(), [] as [id_core::graph::social::FeedEntry; 0]); } #[test] diff --git a/pkgs/id/crates/id-core/tests/stream_lifecycle_model.rs b/pkgs/id/crates/id-core/tests/stream_lifecycle_model.rs index 2b1b371d26..88d4d3b180 100644 --- a/pkgs/id/crates/id-core/tests/stream_lifecycle_model.rs +++ b/pkgs/id/crates/id-core/tests/stream_lifecycle_model.rs @@ -277,7 +277,7 @@ fn chain_and_authorization_rejections_carry_their_classes() { // None of the rejections moved the chain. assert_eq!(stream.descriptor().current_seq, 0); - assert!(stream.chain().is_empty()); + assert_eq!(stream.chain(), []); } #[test] diff --git a/pkgs/id/crates/id-core/tests/succeeds_dag.rs b/pkgs/id/crates/id-core/tests/succeeds_dag.rs index 469c9658b8..7c7532c9fc 100644 --- a/pkgs/id/crates/id-core/tests/succeeds_dag.rs +++ b/pkgs/id/crates/id-core/tests/succeeds_dag.rs @@ -76,7 +76,7 @@ fn edge(from: u8, to: u8) -> SucceedsEdge { fn dag_with(versions: &[u8], name: &str) -> VersionDag { let mut dag = VersionDag::new(); for n in versions { - assert!(dag.add_version(version(*n, name)).unwrap().is_empty()); + assert_eq!(dag.add_version(version(*n, name)).unwrap(), [] as [version::Resolution; 0]); } dag } @@ -138,8 +138,8 @@ fn self_edge_cross_object_and_schema_mismatch_reject() { dag.admit(edge(1, 4)).unwrap_err().class(), "invalid_successor" ); - assert!(dag.edges().is_empty()); - assert!(dag.pending().is_empty()); + assert_eq!(dag.edges(), [] as [version::SucceedsEdge; 0]); + assert_eq!(dag.pending(), []); } #[test] @@ -183,7 +183,7 @@ fn incomplete_ancestry_stays_pending_until_the_version_arrives() { assert_eq!(resolved[0].outcome, Ok(Admission::Accepted)); assert_eq!(resolved[1].edge, edge(9, 1)); assert_eq!(resolved[1].outcome, Err(VersionError::LineageCycle)); - assert!(dag.pending().is_empty()); + assert_eq!(dag.pending(), []); assert_eq!(dag.heads(&object("doc")), vec![vid(9)]); } @@ -223,7 +223,7 @@ fn branches_keep_every_head_and_only_an_owner_selection_picks_one() { #[test] fn a_version_id_cannot_change_its_object_or_schema() { let mut dag = dag_with(&[1], "doc"); - assert!(dag.add_version(version(1, "doc")).unwrap().is_empty()); + assert_eq!(dag.add_version(version(1, "doc")).unwrap(), [] as [version::Resolution; 0]); assert_eq!( dag.add_version(version(1, "other")).unwrap_err().class(), "invalid_successor" diff --git a/pkgs/id/crates/id-core/tests/swarm_bench.rs b/pkgs/id/crates/id-core/tests/swarm_bench.rs index 85df63f708..954d3d02c7 100644 --- a/pkgs/id/crates/id-core/tests/swarm_bench.rs +++ b/pkgs/id/crates/id-core/tests/swarm_bench.rs @@ -156,7 +156,7 @@ fn drive_endgame() -> Run { ], ); let first = sched.assignments(); - assert!(!first.is_empty()); + assert_ne!(first, [] as [id_core::swarm::Assignment; 0]); let dup = sched.assignments(); // endgame: duplicates of in-flight let mut duplicated_bytes = 0u64; let mut delivered: Vec = Vec::new(); From 3be7d924621ab7a867589f5ba57568941acae923 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 24 Nov 2026 14:42:51 +0000 Subject: [PATCH 3/6] id-core: qualify clippy-suggested empty-array element paths with crate:: (#803) Clippy's assert_is_empty suggestions render crate-internal types as bare module paths (abuse::BudgetLimit, membership::AuthId, ...) that do not resolve from inside the modules' own test code; prefix them with crate::. Also annotate the id_uri segments() empty comparison as [String; 0] (E0282 on the bare [] form). --- pkgs/id/crates/id-core/src/abuse.rs | 6 +++--- pkgs/id/crates/id-core/src/append_list.rs | 4 ++-- pkgs/id/crates/id-core/src/id_uri.rs | 2 +- pkgs/id/crates/id-core/src/membership/layer.rs | 2 +- pkgs/id/crates/id-core/src/sanctions.rs | 2 +- pkgs/id/crates/id-core/src/tuple.rs | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/id/crates/id-core/src/abuse.rs b/pkgs/id/crates/id-core/src/abuse.rs index a9aa2b104f..70f0f0bf57 100644 --- a/pkgs/id/crates/id-core/src/abuse.rs +++ b/pkgs/id/crates/id-core/src/abuse.rs @@ -1825,7 +1825,7 @@ mod tests { let eval = evaluator(); assert_eq!( eval.counters().snapshot_directional(), - [] as [(([u8; 32], [u8; 32]), abuse::DirectionalCounters); 0] + [] as [(([u8; 32], [u8; 32]), crate::abuse::DirectionalCounters); 0] ); } } @@ -1886,7 +1886,7 @@ mod budget_tests { ); assert_eq!( policy.counterparty_overrides, - [] as [([u8; 32], std::vec::Vec); 0] + [] as [([u8; 32], std::vec::Vec); 0] ); } @@ -2105,7 +2105,7 @@ mod budget_tests { .expect("unconfigured budgets never refuse"); assert_eq!( eval.budget_usage(0), - [] as [(abuse::BudgetScope, abuse::BudgetLimit, abuse::BudgetUsage); 0] + [] as [(crate::abuse::BudgetScope, crate::abuse::BudgetLimit, crate::abuse::BudgetUsage); 0] ); } } diff --git a/pkgs/id/crates/id-core/src/append_list.rs b/pkgs/id/crates/id-core/src/append_list.rs index c6657f7a4d..45a9d20f32 100644 --- a/pkgs/id/crates/id-core/src/append_list.rs +++ b/pkgs/id/crates/id-core/src/append_list.rs @@ -600,7 +600,7 @@ mod tests { assert_eq!(server.read(ATTR, None, None).unwrap(), []); assert_eq!( server.pending(ATTR, &key(1).verifying_key()).unwrap(), - [] as [&append_list::PendingSubmission; 0] + [] as [&crate::append_list::PendingSubmission; 0] ); assert_eq!(server.own_state(ATTR, &public, &hash), Ok(None)); } @@ -619,7 +619,7 @@ mod tests { server.open(ATTR, &key(1).verifying_key()).unwrap(); assert_eq!( server.pending(ATTR, &key(1).verifying_key()).unwrap(), - [] as [&append_list::PendingSubmission; 0] + [] as [&crate::append_list::PendingSubmission; 0] ); assert_eq!(server.read(ATTR, None, None).unwrap(), []); } diff --git a/pkgs/id/crates/id-core/src/id_uri.rs b/pkgs/id/crates/id-core/src/id_uri.rs index b0d9ec2b19..4554bfad01 100644 --- a/pkgs/id/crates/id-core/src/id_uri.rs +++ b/pkgs/id/crates/id-core/src/id_uri.rs @@ -571,7 +571,7 @@ mod tests { assert_ne!(without, with); assert_eq!(with.segments(), ["a", ""]); assert_eq!(with.to_string(), "id://h/ns/a/"); - assert_eq!(IdUri::parse("id://h/ns").unwrap().segments(), []); + assert_eq!(IdUri::parse("id://h/ns").unwrap().segments(), [] as [String; 0]); assert_eq!(IdUri::parse("id://h/ns/").unwrap().segments(), [""]); } diff --git a/pkgs/id/crates/id-core/src/membership/layer.rs b/pkgs/id/crates/id-core/src/membership/layer.rs index cbedb95f44..f383d37047 100644 --- a/pkgs/id/crates/id-core/src/membership/layer.rs +++ b/pkgs/id/crates/id-core/src/membership/layer.rs @@ -943,7 +943,7 @@ mod tests { member_keys(&layer, 30), vec![AuthId::Key(key(1)), AuthId::Key(key(2))] ); - assert_eq!(layer.members(id(10)), [] as [(membership::AuthId, p2panda_auth::Access); 0]); + assert_eq!(layer.members(id(10)), [] as [(crate::membership::AuthId, p2panda_auth::Access); 0]); } #[test] diff --git a/pkgs/id/crates/id-core/src/sanctions.rs b/pkgs/id/crates/id-core/src/sanctions.rs index 1c6737938f..d016af9cdd 100644 --- a/pkgs/id/crates/id-core/src/sanctions.rs +++ b/pkgs/id/crates/id-core/src/sanctions.rs @@ -648,7 +648,7 @@ mod tests { let v1 = list(1, vec![]); let v2 = list(2, vec![SanctionsEntry::Country { code: "CU".into() }]); let before = find_matches(&v1, Some("CU"), &BTreeSet::new(), &BTreeSet::new()); - assert_eq!(before, [] as [sanctions::SubjectMatch; 0]); + assert_eq!(before, [] as [crate::sanctions::SubjectMatch; 0]); let after = find_matches(&v2, Some("CU"), &BTreeSet::new(), &BTreeSet::new()); let d = evaluate( &boundary(), diff --git a/pkgs/id/crates/id-core/src/tuple.rs b/pkgs/id/crates/id-core/src/tuple.rs index c43937d2ad..5b1d704c05 100644 --- a/pkgs/id/crates/id-core/src/tuple.rs +++ b/pkgs/id/crates/id-core/src/tuple.rs @@ -1175,7 +1175,7 @@ mod tests { #[test] fn test_decode_empty() { let vals = decode(&[]).unwrap(); - assert_eq!(vals, [] as [tuple::TupleValue; 0]); + assert_eq!(vals, [] as [crate::tuple::TupleValue; 0]); } #[test] From dce729e8f5932f1c22338b9db126438ff4257aa2 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 24 Nov 2026 14:54:31 +0000 Subject: [PATCH 4/6] id-caps: qualify clippy-suggested empty-array element paths with crate:: (#803) Same fix as id-core: world_manifest::ApplyStep, declaration:: DeclarationCard, library_manifest::PlatformRequirement, role_config:: RoleGrant and cap_notice::NoticeLine do not resolve from inside the modules' own test code (21 E0433 in the lib test under --all-features). --- pkgs/id/crates/id-caps/src/cap_notice.rs | 2 +- pkgs/id/crates/id-caps/src/declaration.rs | 10 ++++----- .../id/crates/id-caps/src/library_manifest.rs | 2 +- .../crates/id-caps/src/library_resolution.rs | 4 ++-- pkgs/id/crates/id-caps/src/role_config.rs | 2 +- pkgs/id/crates/id-caps/src/world_manifest.rs | 22 +++++++++---------- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pkgs/id/crates/id-caps/src/cap_notice.rs b/pkgs/id/crates/id-caps/src/cap_notice.rs index c8b1d7e309..9491ad3a7b 100644 --- a/pkgs/id/crates/id-caps/src/cap_notice.rs +++ b/pkgs/id/crates/id-caps/src/cap_notice.rs @@ -518,7 +518,7 @@ mod tests { assert!(notice.should_prompt()); assert!(notice.uncomputable); assert_eq!(notice.client_side.len(), 1); - assert_eq!(notice.server_side, [] as [cap_notice::NoticeLine; 0]); + assert_eq!(notice.server_side, [] as [crate::cap_notice::NoticeLine; 0]); assert_eq!(notice.client_side[0].class, CLASS_UNKNOWN); assert_eq!( notice.client_side[0].message, diff --git a/pkgs/id/crates/id-caps/src/declaration.rs b/pkgs/id/crates/id-caps/src/declaration.rs index 535b37a675..922efc3578 100644 --- a/pkgs/id/crates/id-caps/src/declaration.rs +++ b/pkgs/id/crates/id-caps/src/declaration.rs @@ -1250,7 +1250,7 @@ mod tests { let mut registry = DeclarationRegistry::new(); let digest = registry.file_signed(&signed, 200).expect("filing succeeds"); // Filed is discoverable by nobody and grantable by nobody (D6). - assert_eq!(registry.declaration_view(), [] as [declaration::DeclarationCard; 0]); + assert_eq!(registry.declaration_view(), [] as [crate::declaration::DeclarationCard; 0]); assert!(registry.resolve_tuple(&identity, "echo", 1).is_none()); let admission = registry .admit(&digest, "registry-1", 210) @@ -1349,7 +1349,7 @@ mod tests { registry.file_signed(&forged, 200), Err(DeclarationRefusal::BadSignature) ); - assert_eq!(registry.declaration_view(), [] as [declaration::DeclarationCard; 0]); + assert_eq!(registry.declaration_view(), [] as [crate::declaration::DeclarationCard; 0]); // A tampered field after signing also fails verification. let mut tampered = SignedManifest::sign(declaration(&provider, "forged.provider", 1), &provider); @@ -1469,7 +1469,7 @@ mod tests { assert_eq!(registry.declaration_view().len(), 1); let genuine = SignedWithdrawal::sign(identity, "main".to_owned(), 1, 1, &provider); registry.withdraw(&genuine).expect("withdrawal applies"); - assert_eq!(registry.declaration_view(), [] as [declaration::DeclarationCard; 0]); + assert_eq!(registry.declaration_view(), [] as [crate::declaration::DeclarationCard; 0]); assert_eq!( registry .fetch_by_digest(&digest) @@ -1495,7 +1495,7 @@ mod tests { registry.tick(9_999); assert_eq!(registry.declaration_view().len(), 1); registry.tick(10_000); - assert_eq!(registry.declaration_view(), [] as [declaration::DeclarationCard; 0]); + assert_eq!(registry.declaration_view(), [] as [crate::declaration::DeclarationCard; 0]); assert_eq!( registry .fetch_by_digest(&digest) @@ -1562,7 +1562,7 @@ mod tests { .expect("admitted"); registry.mark_live(&digest).expect("live"); registry.suspend(&digest).expect("suspends"); - assert_eq!(registry.declaration_view(), [] as [declaration::DeclarationCard; 0]); + assert_eq!(registry.declaration_view(), [] as [crate::declaration::DeclarationCard; 0]); registry.resume(&digest).expect("resumes"); let view = registry.declaration_view(); assert_eq!(view.len(), 1); diff --git a/pkgs/id/crates/id-caps/src/library_manifest.rs b/pkgs/id/crates/id-caps/src/library_manifest.rs index a139571340..f6600ca0b7 100644 --- a/pkgs/id/crates/id-caps/src/library_manifest.rs +++ b/pkgs/id/crates/id-caps/src/library_manifest.rs @@ -725,7 +725,7 @@ library "pure-lib" version="0.1.0" { "#; let m = LibraryManifest::parse(text).unwrap(); assert!(m.is_pure()); - assert_eq!(m.requirements, [] as [library_manifest::PlatformRequirement; 0]); + assert_eq!(m.requirements, [] as [crate::library_manifest::PlatformRequirement; 0]); } #[test] diff --git a/pkgs/id/crates/id-caps/src/library_resolution.rs b/pkgs/id/crates/id-caps/src/library_resolution.rs index 6f41bc706b..1501790885 100644 --- a/pkgs/id/crates/id-caps/src/library_resolution.rs +++ b/pkgs/id/crates/id-caps/src/library_resolution.rs @@ -462,7 +462,7 @@ mod tests { } assert_eq!( record.transitive_requirements, - [] as [library_manifest::PlatformRequirement; 0] + [] as [crate::library_manifest::PlatformRequirement; 0] ); } @@ -543,7 +543,7 @@ mod tests { assert_eq!(record.outcome, ResolutionOutcome::Resolved); assert_eq!( record.transitive_requirements, - [] as [library_manifest::PlatformRequirement; 0] + [] as [crate::library_manifest::PlatformRequirement; 0] ); assert!(!record.declared_only); } diff --git a/pkgs/id/crates/id-caps/src/role_config.rs b/pkgs/id/crates/id-caps/src/role_config.rs index 0f3b6f49fa..f0ad1f010e 100644 --- a/pkgs/id/crates/id-caps/src/role_config.rs +++ b/pkgs/id/crates/id-caps/src/role_config.rs @@ -681,7 +681,7 @@ mod tests { let revoked = registry.revoke("participant", agent(9), OWNER, NOW + 3); assert_eq!(revoked.decision, Ok(())); assert_eq!(revoked.event.kind, EVENT_ROLE_REVOKE); - assert_eq!(registry.list_grants(), [] as [&role_config::RoleGrant; 0]); + assert_eq!(registry.list_grants(), [] as [&crate::role_config::RoleGrant; 0]); // Revoking a grant that is not held is refused and audited. let missing = registry.revoke("participant", agent(9), OWNER, NOW + 4); diff --git a/pkgs/id/crates/id-caps/src/world_manifest.rs b/pkgs/id/crates/id-caps/src/world_manifest.rs index b85df4ed15..92000da7f2 100644 --- a/pkgs/id/crates/id-caps/src/world_manifest.rs +++ b/pkgs/id/crates/id-caps/src/world_manifest.rs @@ -745,7 +745,7 @@ native_memory_bytes = 16777216", fn an_empty_manifest_drifts_nothing() { let manifest = WorldManifest::default(); // A default (empty) manifest leaves a default (empty) world alone. - assert_eq!(plan(&manifest, &WorldState::default()), [] as [world_manifest::ApplyStep; 0]); + assert_eq!(plan(&manifest, &WorldState::default()), [] as [crate::world_manifest::ApplyStep; 0]); // And it leaves a fully populated world alone too (#817): every field // is unspecified, so nothing is revoked, widened, or cancelled. let state = WorldState { @@ -756,7 +756,7 @@ native_memory_bytes = 16777216", schedules: BTreeMap::from([("round".to_owned(), 5)]), ..WorldState::default() }; - assert_eq!(plan(&manifest, &state), [] as [world_manifest::ApplyStep; 0]); + assert_eq!(plan(&manifest, &state), [] as [crate::world_manifest::ApplyStep; 0]); } #[test] @@ -865,7 +865,7 @@ native_memory_bytes = 16777216", // None โ€” and None means the default ceiling, so nothing drifts. state.ceiling = fold_reported_ceiling(state.ceiling.clone().unwrap()); assert_eq!(state.ceiling, None); - assert_eq!(plan(&manifest, &state), [] as [world_manifest::ApplyStep; 0]); + assert_eq!(plan(&manifest, &state), [] as [crate::world_manifest::ApplyStep; 0]); // A host report of exactly the default list (never folded by hand) // also converges from the start. let reported = WorldState { @@ -876,7 +876,7 @@ native_memory_bytes = 16777216", ceiling: fold_reported_ceiling(reported.ceiling.clone().unwrap()), ..reported }; - assert_eq!(plan(&manifest, &folded), [] as [world_manifest::ApplyStep; 0]); + assert_eq!(plan(&manifest, &folded), [] as [crate::world_manifest::ApplyStep; 0]); } #[test] @@ -911,7 +911,7 @@ native_memory_bytes = 16777216", }] ); let omitted = WorldManifest::default(); - assert_eq!(plan(&omitted, ¤t), [] as [world_manifest::ApplyStep; 0]); + assert_eq!(plan(&omitted, ¤t), [] as [crate::world_manifest::ApplyStep; 0]); } #[test] @@ -950,11 +950,11 @@ native_memory_bytes = 16777216", let manifest = parse(manifest_toml()).unwrap(); let mut state = WorldState::default(); let steps = plan(&manifest, &state); - assert_ne!(steps, [] as [world_manifest::ApplyStep; 0]); + assert_ne!(steps, [] as [crate::world_manifest::ApplyStep; 0]); let changed = apply(&steps, &mut state).unwrap(); assert_eq!(changed, steps.len()); // A second plan against the reconciled state is empty. - assert_eq!(plan(&manifest, &state), [] as [world_manifest::ApplyStep; 0]); + assert_eq!(plan(&manifest, &state), [] as [crate::world_manifest::ApplyStep; 0]); } #[test] @@ -1186,7 +1186,7 @@ native_memory_bytes = 16777216", // Applying the step reconciles: a second plan is empty. let mut applied = state.clone(); apply(&steps, &mut applied).unwrap(); - assert_eq!(plan(&manifest, &applied), [] as [world_manifest::ApplyStep; 0]); + assert_eq!(plan(&manifest, &applied), [] as [crate::world_manifest::ApplyStep; 0]); } #[test] @@ -1237,12 +1237,12 @@ native_memory_bytes = 16777216", // #1519 ruling: no installed program and none desired -- there is // nothing whose seed could change. let manifest = parse("seed = 99").unwrap(); - assert_eq!(plan(&manifest, &WorldState::default()), [] as [world_manifest::ApplyStep; 0]); + assert_eq!(plan(&manifest, &WorldState::default()), [] as [crate::world_manifest::ApplyStep; 0]); let state = WorldState { seed: 7, ..WorldState::default() }; - assert_eq!(plan(&manifest, &state), [] as [world_manifest::ApplyStep; 0]); + assert_eq!(plan(&manifest, &state), [] as [crate::world_manifest::ApplyStep; 0]); } #[test] @@ -1254,7 +1254,7 @@ native_memory_bytes = 16777216", ceiling: Some(vec!["time.now".to_owned(), "chat.say".to_owned()]), ..WorldState::default() }; - assert_eq!(plan(&manifest, &state), [] as [world_manifest::ApplyStep; 0]); + assert_eq!(plan(&manifest, &state), [] as [crate::world_manifest::ApplyStep; 0]); } #[test] From 2e22f3f7903bd6839e0e2a2f2846198085558b99 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 24 Nov 2026 15:11:31 +0000 Subject: [PATCH 5/6] id: rustfmt-wrap the converted empty-array assertions (#803) Wrap the assert_eq!/assert_ne! conversions whose single-line form exceeds the width rustfmt accepts for these macro calls, matching rustfmt's own output (verified against cargo fmt --check on the fleet runner; pre-existing fmt drift in untouched files such as screen_codec.rs and benches/world_bench.rs is left alone). --- pkgs/id/crates/id-caps/src/cap_notice.rs | 5 +- pkgs/id/crates/id-caps/src/declaration.rs | 25 ++++++++-- .../id/crates/id-caps/src/library_manifest.rs | 5 +- pkgs/id/crates/id-caps/src/role_config.rs | 5 +- pkgs/id/crates/id-caps/src/world_manifest.rs | 50 +++++++++++++++---- pkgs/id/crates/id-core/src/abuse.rs | 6 ++- pkgs/id/crates/id-core/src/access.rs | 5 +- pkgs/id/crates/id-core/src/id_uri.rs | 5 +- .../id/crates/id-core/src/membership/layer.rs | 5 +- pkgs/id/crates/id-core/src/waiting.rs | 5 +- .../id-core/tests/social_graph_traversal.rs | 10 +++- pkgs/id/crates/id-core/tests/succeeds_dag.rs | 10 +++- pkgs/id/crates/id-render/tests/compose.rs | 10 +++- pkgs/id/crates/id-render/tests/lower.rs | 10 +++- pkgs/id/crates/id-render/tests/lower_gui.rs | 10 +++- .../id/crates/id-render/tests/lower_native.rs | 10 +++- 16 files changed, 141 insertions(+), 35 deletions(-) diff --git a/pkgs/id/crates/id-caps/src/cap_notice.rs b/pkgs/id/crates/id-caps/src/cap_notice.rs index 9491ad3a7b..c3053f6e65 100644 --- a/pkgs/id/crates/id-caps/src/cap_notice.rs +++ b/pkgs/id/crates/id-caps/src/cap_notice.rs @@ -518,7 +518,10 @@ mod tests { assert!(notice.should_prompt()); assert!(notice.uncomputable); assert_eq!(notice.client_side.len(), 1); - assert_eq!(notice.server_side, [] as [crate::cap_notice::NoticeLine; 0]); + assert_eq!( + notice.server_side, + [] as [crate::cap_notice::NoticeLine; 0] + ); assert_eq!(notice.client_side[0].class, CLASS_UNKNOWN); assert_eq!( notice.client_side[0].message, diff --git a/pkgs/id/crates/id-caps/src/declaration.rs b/pkgs/id/crates/id-caps/src/declaration.rs index 922efc3578..08b67702b5 100644 --- a/pkgs/id/crates/id-caps/src/declaration.rs +++ b/pkgs/id/crates/id-caps/src/declaration.rs @@ -1250,7 +1250,10 @@ mod tests { let mut registry = DeclarationRegistry::new(); let digest = registry.file_signed(&signed, 200).expect("filing succeeds"); // Filed is discoverable by nobody and grantable by nobody (D6). - assert_eq!(registry.declaration_view(), [] as [crate::declaration::DeclarationCard; 0]); + assert_eq!( + registry.declaration_view(), + [] as [crate::declaration::DeclarationCard; 0] + ); assert!(registry.resolve_tuple(&identity, "echo", 1).is_none()); let admission = registry .admit(&digest, "registry-1", 210) @@ -1349,7 +1352,10 @@ mod tests { registry.file_signed(&forged, 200), Err(DeclarationRefusal::BadSignature) ); - assert_eq!(registry.declaration_view(), [] as [crate::declaration::DeclarationCard; 0]); + assert_eq!( + registry.declaration_view(), + [] as [crate::declaration::DeclarationCard; 0] + ); // A tampered field after signing also fails verification. let mut tampered = SignedManifest::sign(declaration(&provider, "forged.provider", 1), &provider); @@ -1469,7 +1475,10 @@ mod tests { assert_eq!(registry.declaration_view().len(), 1); let genuine = SignedWithdrawal::sign(identity, "main".to_owned(), 1, 1, &provider); registry.withdraw(&genuine).expect("withdrawal applies"); - assert_eq!(registry.declaration_view(), [] as [crate::declaration::DeclarationCard; 0]); + assert_eq!( + registry.declaration_view(), + [] as [crate::declaration::DeclarationCard; 0] + ); assert_eq!( registry .fetch_by_digest(&digest) @@ -1495,7 +1504,10 @@ mod tests { registry.tick(9_999); assert_eq!(registry.declaration_view().len(), 1); registry.tick(10_000); - assert_eq!(registry.declaration_view(), [] as [crate::declaration::DeclarationCard; 0]); + assert_eq!( + registry.declaration_view(), + [] as [crate::declaration::DeclarationCard; 0] + ); assert_eq!( registry .fetch_by_digest(&digest) @@ -1562,7 +1574,10 @@ mod tests { .expect("admitted"); registry.mark_live(&digest).expect("live"); registry.suspend(&digest).expect("suspends"); - assert_eq!(registry.declaration_view(), [] as [crate::declaration::DeclarationCard; 0]); + assert_eq!( + registry.declaration_view(), + [] as [crate::declaration::DeclarationCard; 0] + ); registry.resume(&digest).expect("resumes"); let view = registry.declaration_view(); assert_eq!(view.len(), 1); diff --git a/pkgs/id/crates/id-caps/src/library_manifest.rs b/pkgs/id/crates/id-caps/src/library_manifest.rs index f6600ca0b7..788b46183b 100644 --- a/pkgs/id/crates/id-caps/src/library_manifest.rs +++ b/pkgs/id/crates/id-caps/src/library_manifest.rs @@ -725,7 +725,10 @@ library "pure-lib" version="0.1.0" { "#; let m = LibraryManifest::parse(text).unwrap(); assert!(m.is_pure()); - assert_eq!(m.requirements, [] as [crate::library_manifest::PlatformRequirement; 0]); + assert_eq!( + m.requirements, + [] as [crate::library_manifest::PlatformRequirement; 0] + ); } #[test] diff --git a/pkgs/id/crates/id-caps/src/role_config.rs b/pkgs/id/crates/id-caps/src/role_config.rs index f0ad1f010e..cbc7958ca7 100644 --- a/pkgs/id/crates/id-caps/src/role_config.rs +++ b/pkgs/id/crates/id-caps/src/role_config.rs @@ -681,7 +681,10 @@ mod tests { let revoked = registry.revoke("participant", agent(9), OWNER, NOW + 3); assert_eq!(revoked.decision, Ok(())); assert_eq!(revoked.event.kind, EVENT_ROLE_REVOKE); - assert_eq!(registry.list_grants(), [] as [&crate::role_config::RoleGrant; 0]); + assert_eq!( + registry.list_grants(), + [] as [&crate::role_config::RoleGrant; 0] + ); // Revoking a grant that is not held is refused and audited. let missing = registry.revoke("participant", agent(9), OWNER, NOW + 4); diff --git a/pkgs/id/crates/id-caps/src/world_manifest.rs b/pkgs/id/crates/id-caps/src/world_manifest.rs index 92000da7f2..1bad369ddb 100644 --- a/pkgs/id/crates/id-caps/src/world_manifest.rs +++ b/pkgs/id/crates/id-caps/src/world_manifest.rs @@ -745,7 +745,10 @@ native_memory_bytes = 16777216", fn an_empty_manifest_drifts_nothing() { let manifest = WorldManifest::default(); // A default (empty) manifest leaves a default (empty) world alone. - assert_eq!(plan(&manifest, &WorldState::default()), [] as [crate::world_manifest::ApplyStep; 0]); + assert_eq!( + plan(&manifest, &WorldState::default()), + [] as [crate::world_manifest::ApplyStep; 0] + ); // And it leaves a fully populated world alone too (#817): every field // is unspecified, so nothing is revoked, widened, or cancelled. let state = WorldState { @@ -756,7 +759,10 @@ native_memory_bytes = 16777216", schedules: BTreeMap::from([("round".to_owned(), 5)]), ..WorldState::default() }; - assert_eq!(plan(&manifest, &state), [] as [crate::world_manifest::ApplyStep; 0]); + assert_eq!( + plan(&manifest, &state), + [] as [crate::world_manifest::ApplyStep; 0] + ); } #[test] @@ -865,7 +871,10 @@ native_memory_bytes = 16777216", // None โ€” and None means the default ceiling, so nothing drifts. state.ceiling = fold_reported_ceiling(state.ceiling.clone().unwrap()); assert_eq!(state.ceiling, None); - assert_eq!(plan(&manifest, &state), [] as [crate::world_manifest::ApplyStep; 0]); + assert_eq!( + plan(&manifest, &state), + [] as [crate::world_manifest::ApplyStep; 0] + ); // A host report of exactly the default list (never folded by hand) // also converges from the start. let reported = WorldState { @@ -876,7 +885,10 @@ native_memory_bytes = 16777216", ceiling: fold_reported_ceiling(reported.ceiling.clone().unwrap()), ..reported }; - assert_eq!(plan(&manifest, &folded), [] as [crate::world_manifest::ApplyStep; 0]); + assert_eq!( + plan(&manifest, &folded), + [] as [crate::world_manifest::ApplyStep; 0] + ); } #[test] @@ -911,7 +923,10 @@ native_memory_bytes = 16777216", }] ); let omitted = WorldManifest::default(); - assert_eq!(plan(&omitted, ¤t), [] as [crate::world_manifest::ApplyStep; 0]); + assert_eq!( + plan(&omitted, ¤t), + [] as [crate::world_manifest::ApplyStep; 0] + ); } #[test] @@ -954,7 +969,10 @@ native_memory_bytes = 16777216", let changed = apply(&steps, &mut state).unwrap(); assert_eq!(changed, steps.len()); // A second plan against the reconciled state is empty. - assert_eq!(plan(&manifest, &state), [] as [crate::world_manifest::ApplyStep; 0]); + assert_eq!( + plan(&manifest, &state), + [] as [crate::world_manifest::ApplyStep; 0] + ); } #[test] @@ -1186,7 +1204,10 @@ native_memory_bytes = 16777216", // Applying the step reconciles: a second plan is empty. let mut applied = state.clone(); apply(&steps, &mut applied).unwrap(); - assert_eq!(plan(&manifest, &applied), [] as [crate::world_manifest::ApplyStep; 0]); + assert_eq!( + plan(&manifest, &applied), + [] as [crate::world_manifest::ApplyStep; 0] + ); } #[test] @@ -1237,12 +1258,18 @@ native_memory_bytes = 16777216", // #1519 ruling: no installed program and none desired -- there is // nothing whose seed could change. let manifest = parse("seed = 99").unwrap(); - assert_eq!(plan(&manifest, &WorldState::default()), [] as [crate::world_manifest::ApplyStep; 0]); + assert_eq!( + plan(&manifest, &WorldState::default()), + [] as [crate::world_manifest::ApplyStep; 0] + ); let state = WorldState { seed: 7, ..WorldState::default() }; - assert_eq!(plan(&manifest, &state), [] as [crate::world_manifest::ApplyStep; 0]); + assert_eq!( + plan(&manifest, &state), + [] as [crate::world_manifest::ApplyStep; 0] + ); } #[test] @@ -1254,7 +1281,10 @@ native_memory_bytes = 16777216", ceiling: Some(vec!["time.now".to_owned(), "chat.say".to_owned()]), ..WorldState::default() }; - assert_eq!(plan(&manifest, &state), [] as [crate::world_manifest::ApplyStep; 0]); + assert_eq!( + plan(&manifest, &state), + [] as [crate::world_manifest::ApplyStep; 0] + ); } #[test] diff --git a/pkgs/id/crates/id-core/src/abuse.rs b/pkgs/id/crates/id-core/src/abuse.rs index 70f0f0bf57..ff99289540 100644 --- a/pkgs/id/crates/id-core/src/abuse.rs +++ b/pkgs/id/crates/id-core/src/abuse.rs @@ -2105,7 +2105,11 @@ mod budget_tests { .expect("unconfigured budgets never refuse"); assert_eq!( eval.budget_usage(0), - [] as [(crate::abuse::BudgetScope, crate::abuse::BudgetLimit, crate::abuse::BudgetUsage); 0] + [] as [( + crate::abuse::BudgetScope, + crate::abuse::BudgetLimit, + crate::abuse::BudgetUsage + ); 0] ); } } diff --git a/pkgs/id/crates/id-core/src/access.rs b/pkgs/id/crates/id-core/src/access.rs index 37a7870a60..6b3858a9f1 100644 --- a/pkgs/id/crates/id-core/src/access.rs +++ b/pkgs/id/crates/id-core/src/access.rs @@ -242,7 +242,10 @@ mod tests { #[test] fn load_allowed_nodes_missing_file_is_empty() { let dir = tempfile::TempDir::new().unwrap(); - assert_eq!(load_allowed_nodes(dir.path()), [] as [iroh_base::PublicKey; 0]); + assert_eq!( + load_allowed_nodes(dir.path()), + [] as [iroh_base::PublicKey; 0] + ); } #[test] diff --git a/pkgs/id/crates/id-core/src/id_uri.rs b/pkgs/id/crates/id-core/src/id_uri.rs index 4554bfad01..0c5ae66b5b 100644 --- a/pkgs/id/crates/id-core/src/id_uri.rs +++ b/pkgs/id/crates/id-core/src/id_uri.rs @@ -571,7 +571,10 @@ mod tests { assert_ne!(without, with); assert_eq!(with.segments(), ["a", ""]); assert_eq!(with.to_string(), "id://h/ns/a/"); - assert_eq!(IdUri::parse("id://h/ns").unwrap().segments(), [] as [String; 0]); + assert_eq!( + IdUri::parse("id://h/ns").unwrap().segments(), + [] as [String; 0] + ); assert_eq!(IdUri::parse("id://h/ns/").unwrap().segments(), [""]); } diff --git a/pkgs/id/crates/id-core/src/membership/layer.rs b/pkgs/id/crates/id-core/src/membership/layer.rs index f383d37047..5057eb0831 100644 --- a/pkgs/id/crates/id-core/src/membership/layer.rs +++ b/pkgs/id/crates/id-core/src/membership/layer.rs @@ -943,7 +943,10 @@ mod tests { member_keys(&layer, 30), vec![AuthId::Key(key(1)), AuthId::Key(key(2))] ); - assert_eq!(layer.members(id(10)), [] as [(crate::membership::AuthId, p2panda_auth::Access); 0]); + assert_eq!( + layer.members(id(10)), + [] as [(crate::membership::AuthId, p2panda_auth::Access); 0] + ); } #[test] diff --git a/pkgs/id/crates/id-core/src/waiting.rs b/pkgs/id/crates/id-core/src/waiting.rs index 8aafe908f8..c4239f63d4 100644 --- a/pkgs/id/crates/id-core/src/waiting.rs +++ b/pkgs/id/crates/id-core/src/waiting.rs @@ -669,7 +669,10 @@ mod tests { fn test_expiry_is_inclusive_at_max_age_and_exclusive_one_ms_before() { let mut pool = pool(); pool.insert(author(1), 1, [9], "e1", 1_000).unwrap(); - assert_eq!(pool.expire(1_000 + WEEK_MS - 1), [] as [([u8; 32], &str); 0]); + assert_eq!( + pool.expire(1_000 + WEEK_MS - 1), + [] as [([u8; 32], &str); 0] + ); assert_eq!(pool.len(), 1); assert_eq!(pool.expire(1_000 + WEEK_MS), vec![(author(1), "e1")]); assert_eq!(pool.waiting_count(author(1)), 0); diff --git a/pkgs/id/crates/id-core/tests/social_graph_traversal.rs b/pkgs/id/crates/id-core/tests/social_graph_traversal.rs index b13da8d751..59c545d30f 100644 --- a/pkgs/id/crates/id-core/tests/social_graph_traversal.rs +++ b/pkgs/id/crates/id-core/tests/social_graph_traversal.rs @@ -323,7 +323,10 @@ fn missing_root_is_an_empty_complete_traversal() { let objects = vec![obj(1, SocialObjectKind::Topic, None)]; let traversal = traverse(&objects, &oid(9), &TraversalProfile::default(), |_| true); assert!(traversal.complete); - assert_eq!(traversal.entries, [] as [id_core::graph::social::TraversalEntry; 0]); + assert_eq!( + traversal.entries, + [] as [id_core::graph::social::TraversalEntry; 0] + ); } fn scope() -> FeedScope { @@ -411,7 +414,10 @@ fn since_and_before_page_the_pinned_snapshot() { .map(|entry| entry.entry_id.clone()) .collect(); assert_eq!(older, vec!["a1", "b1", "a2"]); - assert_eq!(ledger.since(&head).unwrap(), [] as [id_core::graph::social::FeedEntry; 0]); + assert_eq!( + ledger.since(&head).unwrap(), + [] as [id_core::graph::social::FeedEntry; 0] + ); } #[test] diff --git a/pkgs/id/crates/id-core/tests/succeeds_dag.rs b/pkgs/id/crates/id-core/tests/succeeds_dag.rs index 7c7532c9fc..6b8decde4d 100644 --- a/pkgs/id/crates/id-core/tests/succeeds_dag.rs +++ b/pkgs/id/crates/id-core/tests/succeeds_dag.rs @@ -76,7 +76,10 @@ fn edge(from: u8, to: u8) -> SucceedsEdge { fn dag_with(versions: &[u8], name: &str) -> VersionDag { let mut dag = VersionDag::new(); for n in versions { - assert_eq!(dag.add_version(version(*n, name)).unwrap(), [] as [version::Resolution; 0]); + assert_eq!( + dag.add_version(version(*n, name)).unwrap(), + [] as [version::Resolution; 0] + ); } dag } @@ -223,7 +226,10 @@ fn branches_keep_every_head_and_only_an_owner_selection_picks_one() { #[test] fn a_version_id_cannot_change_its_object_or_schema() { let mut dag = dag_with(&[1], "doc"); - assert_eq!(dag.add_version(version(1, "doc")).unwrap(), [] as [version::Resolution; 0]); + assert_eq!( + dag.add_version(version(1, "doc")).unwrap(), + [] as [version::Resolution; 0] + ); assert_eq!( dag.add_version(version(1, "other")).unwrap_err().class(), "invalid_successor" diff --git a/pkgs/id/crates/id-render/tests/compose.rs b/pkgs/id/crates/id-render/tests/compose.rs index 8848321ada..6713935a29 100644 --- a/pkgs/id/crates/id-render/tests/compose.rs +++ b/pkgs/id/crates/id-render/tests/compose.rs @@ -473,9 +473,15 @@ fn target_locality_other_targets_declarations_do_not_leak_decision_5854_s2_4() { let composed = compose_document(&doc, &target("native"), &ComposeData::default()).expect("composes"); let button = find(&composed.root, BUTTON_PATH).expect("button present"); - assert_eq!(button.properties, [] as [id_render::compose::ResolvedProperty; 0]); + assert_eq!( + button.properties, + [] as [id_render::compose::ResolvedProperty; 0] + ); assert_eq!(button.presentation, None); - assert_eq!(composed.report.warnings, [] as [id_render::compose::CompositionWarning; 0]); + assert_eq!( + composed.report.warnings, + [] as [id_render::compose::CompositionWarning; 0] + ); assert_eq!( composed.report.reported_overrides, [] as [id_render::compose::ReportedOverride; 0] diff --git a/pkgs/id/crates/id-render/tests/lower.rs b/pkgs/id/crates/id-render/tests/lower.rs index bf929d617d..4370886301 100644 --- a/pkgs/id/crates/id-render/tests/lower.rs +++ b/pkgs/id/crates/id-render/tests/lower.rs @@ -213,7 +213,10 @@ fn mapped_roles_emit_utilities_from_decision_5851_s3() { assert!(artefact.class_set.iter().any(|c| c == class)); } assert_eq!(report.mapped.len(), 4); - assert_eq!(report.defaulted, [] as [id_render::lower::DefaultedAssertion; 0]); + assert_eq!( + report.defaulted, + [] as [id_render::lower::DefaultedAssertion; 0] + ); let mut sorted = artefact.class_set.clone(); sorted.sort(); assert_eq!(artefact.class_set, sorted, "class set is order-normalised"); @@ -249,7 +252,10 @@ fn density_is_mapped_without_utilities_decision_5851_s3_3() { lower_web(&doc, &composed(vec![prop("density", "compact")])).expect("lowering succeeds"); assert_eq!(report.mapped.len(), 1); assert_eq!(report.mapped[0].classes, [] as [std::string::String; 0]); - assert_eq!(report.defaulted, [] as [id_render::lower::DefaultedAssertion; 0]); + assert_eq!( + report.defaulted, + [] as [id_render::lower::DefaultedAssertion; 0] + ); assert_eq!( find(&artefact.root, "button").expect("button").classes, [] as [std::string::String; 0] diff --git a/pkgs/id/crates/id-render/tests/lower_gui.rs b/pkgs/id/crates/id-render/tests/lower_gui.rs index 1e017c9175..57ec1fb6b4 100644 --- a/pkgs/id/crates/id-render/tests/lower_gui.rs +++ b/pkgs/id/crates/id-render/tests/lower_gui.rs @@ -175,7 +175,10 @@ fn asset_override_applies_with_per_state_assets_decision_5853_s2_2() { } assert_eq!(report.applied.len(), 1); assert_eq!(report.applied[0].kind, "asset"); - assert_eq!(report.fallbacks, [] as [id_render::lower_gui::ExercisedFallback; 0]); + assert_eq!( + report.fallbacks, + [] as [id_render::lower_gui::ExercisedFallback; 0] + ); } #[test] @@ -303,7 +306,10 @@ fn missing_asset_exercises_the_standard_fallback_decision_5853_s2_4() { } assert_eq!(report.fallbacks.len(), 1); assert!(report.fallbacks[0].warning.contains("assets/gone")); - assert_eq!(report.applied, [] as [id_render::lower_gui::AppliedOverride; 0]); + assert_eq!( + report.applied, + [] as [id_render::lower_gui::AppliedOverride; 0] + ); } #[test] diff --git a/pkgs/id/crates/id-render/tests/lower_native.rs b/pkgs/id/crates/id-render/tests/lower_native.rs index 42d5359843..7cde5c9ffb 100644 --- a/pkgs/id/crates/id-render/tests/lower_native.rs +++ b/pkgs/id/crates/id-render/tests/lower_native.rs @@ -269,7 +269,10 @@ fn mapped_assertions_record_platform_renderings_decision_5852_s3() { ) .expect("lowering succeeds"); assert_eq!(report.mapped.len(), 4); - assert_eq!(report.defaulted, [] as [id_render::lower_native::DefaultedNativeAssertion; 0]); + assert_eq!( + report.defaulted, + [] as [id_render::lower_native::DefaultedNativeAssertion; 0] + ); let rendering = |property: &str| { report .mapped @@ -402,7 +405,10 @@ fn raw_css_winner_is_a_platform_default_on_native_decision_5852_a3() { theme_value: None, }; let (_, report) = lower_native(&doc, &composed("mac", vec![raw])).expect("lowering succeeds"); - assert_eq!(report.mapped, [] as [id_render::lower_native::MappedNativeAssertion; 0]); + assert_eq!( + report.mapped, + [] as [id_render::lower_native::MappedNativeAssertion; 0] + ); assert_eq!(report.defaulted.len(), 1); assert!( report.defaulted[0].warning.contains("rebeccapurple"), From 407cbe6a9e21a3bd361ea768de6971fd14f12767 Mon Sep 17 00:00:00 2001 From: felix Date: Tue, 24 Nov 2026 15:32:16 +0000 Subject: [PATCH 6/6] id-caps: collapse cap_notice empty-lines assertion to one line (#803, rustfmt) --- pkgs/id/crates/id-caps/src/cap_notice.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkgs/id/crates/id-caps/src/cap_notice.rs b/pkgs/id/crates/id-caps/src/cap_notice.rs index c3053f6e65..9491ad3a7b 100644 --- a/pkgs/id/crates/id-caps/src/cap_notice.rs +++ b/pkgs/id/crates/id-caps/src/cap_notice.rs @@ -518,10 +518,7 @@ mod tests { assert!(notice.should_prompt()); assert!(notice.uncomputable); assert_eq!(notice.client_side.len(), 1); - assert_eq!( - notice.server_side, - [] as [crate::cap_notice::NoticeLine; 0] - ); + assert_eq!(notice.server_side, [] as [crate::cap_notice::NoticeLine; 0]); assert_eq!(notice.client_side[0].class, CLASS_UNKNOWN); assert_eq!( notice.client_side[0].message,