share: clippy hygiene in presence names and frame fixture
- Commit
6ea51a9594856f4a5da11ad661f465af383de242- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 22:01 UTC (4 days ago)
- Parents
8c7b3d6
Workspace clippy flagged: as_bytes().len() on Strings in the presence advert tests (now len() directly), and a struct update with no effect in the session-state frame fixture (..Default::default() after the only field). Left standing: the UnknownOsType variant name (a prost wire enum mirrored from the Nearby spec; renaming is wire/API churn, not hygiene) and a repeat_n suggestion stable since Rust 1.87, above the 1.85 MSRV in clippy.toml. Its betocore dependencies' doc-lint warnings are vendored upstream code, untouched. Verified: cargo clippy -p share_nearby --all-targets shows only those items in first-party code, cargo test (119 passed), fmt clean.
Diff
share/src/main/rust/src/presence.rs
diff --git a/share/src/main/rust/src/presence.rs b/share/src/main/rust/src/presence.rsindex d01a4789bb..7e1af59235 100644--- a/share/src/main/rust/src/presence.rs+++ b/share/src/main/rust/src/presence.rs@@ -179,11 +179,11 @@ mod tests { let parsed = parse_presence_advert_name(&adv); assert!(parsed.is_some(), "parse should succeed for {name}"); let got = parsed.unwrap();- if name.as_bytes().len() <= 9 {+ if name.len() <= 9 { let expected = String::from_utf8_lossy(name.as_bytes()).to_string(); assert!(got.starts_with(expected.trim()), "got {got} expected prefix of {name}"); } else {- assert_eq!(got.as_bytes().len(), 9, "truncated name should be 9 bytes");+ assert_eq!(got.len(), 9, "truncated name should be 9 bytes"); } } }
share/src/main/rust/src/session_state_tests.rs
diff --git a/share/src/main/rust/src/session_state_tests.rs b/share/src/main/rust/src/session_state_tests.rsindex 93292fc24e..24b2e19aaf 100644--- a/share/src/main/rust/src/session_state_tests.rs+++ b/share/src/main/rust/src/session_state_tests.rs@@ -391,7 +391,6 @@ fn a_bandwidth_upgrade_request_is_declined_not_ignored() { r#type: frame::OfflineFrameType::BandwidthUpgradeNegotiation as i32, bandwidth_upgrade_negotiation: Some(frame::BandwidthUpgradeNegotiationFrame { event_type: 1,- ..Default::default() }), ..Default::default() }),