From 60ccbfdcf72f98cafa5a8885dc9656b64bd37a79 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Fri, 12 Jun 2026 12:28:13 +0000 Subject: [PATCH] style: cargo fmt --all under rustfmt 1.9 (Rust 1.96) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comment reflow only — the pinned "stable" channel moved and CI checks formatting with the current toolchain. Co-Authored-By: Claude Fable 5 --- crates/punktfunk-client-rs/src/main.rs | 17 ++++++++++++++--- crates/punktfunk-core/src/client.rs | 3 +-- crates/punktfunk-host/src/discovery.rs | 7 ++++++- crates/punktfunk-host/src/inject/dualsense.rs | 15 +++++++++------ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/crates/punktfunk-client-rs/src/main.rs b/crates/punktfunk-client-rs/src/main.rs index d239d63..32aecff 100644 --- a/crates/punktfunk-client-rs/src/main.rs +++ b/crates/punktfunk-client-rs/src/main.rs @@ -274,7 +274,10 @@ fn discover(secs: u64) -> Result<()> { let receiver = daemon .browse("_punktfunk._udp.local.") .context("browse _punktfunk._udp")?; - tracing::info!(secs, "browsing for native punktfunk/1 hosts (_punktfunk._udp)…"); + tracing::info!( + secs, + "browsing for native punktfunk/1 hosts (_punktfunk._udp)…" + ); // One row per host, keyed by the stable uniqueid (falls back to the fullname) so the same // host re-advertising or answering on several interfaces collapses to a single entry. let mut hosts: BTreeMap = BTreeMap::new(); @@ -298,7 +301,12 @@ fn discover(secs: u64) -> Result<()> { .unwrap_or_else(|| "?".into()); let fp = val("fp"); let fp_short = fp.get(..16).unwrap_or(fp.as_str()); - let name = info.get_fullname().split('.').next().unwrap_or("?").to_string(); + let name = info + .get_fullname() + .split('.') + .next() + .unwrap_or("?") + .to_string(); let id = val("id"); let key = if id.is_empty() { info.get_fullname().to_string() @@ -490,7 +498,10 @@ async fn session(args: Args) -> Result<()> { } else { 0 }; - let throughput_kbps = recv_bytes.saturating_mul(8).checked_div(window_ms).unwrap_or(0); + let throughput_kbps = recv_bytes + .saturating_mul(8) + .checked_div(window_ms) + .unwrap_or(0); let loss_pct = if res.bytes_sent > 0 { res.bytes_sent.saturating_sub(recv_bytes) as f64 / res.bytes_sent as f64 * 100.0 } else { diff --git a/crates/punktfunk-core/src/client.rs b/crates/punktfunk-core/src/client.rs index 0962223..e80dda0 100644 --- a/crates/punktfunk-core/src/client.rs +++ b/crates/punktfunk-core/src/client.rs @@ -175,8 +175,7 @@ impl NativeClient { let (mic_tx, mic_rx) = tokio::sync::mpsc::unbounded_channel::<(u32, u64, Vec)>(); let (rich_input_tx, rich_input_rx) = tokio::sync::mpsc::unbounded_channel::(); let (ctrl_tx, ctrl_rx) = tokio::sync::mpsc::unbounded_channel::(); - let (ready_tx, ready_rx) = - std::sync::mpsc::channel::>(); + let (ready_tx, ready_rx) = std::sync::mpsc::channel::>(); let shutdown = Arc::new(AtomicBool::new(false)); let mode_slot = Arc::new(std::sync::Mutex::new(mode)); let probe = Arc::new(Mutex::new(ProbeState::default())); diff --git a/crates/punktfunk-host/src/discovery.rs b/crates/punktfunk-host/src/discovery.rs index d612226..0a18a28 100644 --- a/crates/punktfunk-host/src/discovery.rs +++ b/crates/punktfunk-host/src/discovery.rs @@ -46,7 +46,12 @@ pub fn advertise_native( props.insert("fp".into(), fingerprint.to_string()); props.insert( "pair".into(), - if require_pairing { "required" } else { "optional" }.into(), + if require_pairing { + "required" + } else { + "optional" + } + .into(), ); props.insert("id".into(), uniqueid.to_string()); let service = ServiceInfo::new(NATIVE_SERVICE, hostname, &host_name, ip, port, props) diff --git a/crates/punktfunk-host/src/inject/dualsense.rs b/crates/punktfunk-host/src/inject/dualsense.rs index 24f6b23..2bd170f 100644 --- a/crates/punktfunk-host/src/inject/dualsense.rs +++ b/crates/punktfunk-host/src/inject/dualsense.rs @@ -436,9 +436,9 @@ fn parse_ds_output(pad: u8, data: &[u8], fb: &mut DsFeedback) { } let flag0 = data[1]; // BIT0 compat vibration, BIT1 haptics select, BIT2 R2, BIT3 L2 let flag1 = data[2]; // BIT2 lightbar, BIT4 player indicators - // Motor rumble: high-frequency (small/right) motor at data[3], low-frequency (big/left) at - // data[4]. Scale 0..255 → 0..0xFFFF, same (low, high) convention as the uinput pad's mixer, - // and route to the universal rumble plane (0xCA). + // Motor rumble: high-frequency (small/right) motor at data[3], low-frequency (big/left) at + // data[4]. Scale 0..255 → 0..0xFFFF, same (low, high) convention as the uinput pad's mixer, + // and route to the universal rumble plane (0xCA). if flag0 & 0x03 != 0 { let high = (data[3] as u16) << 8; let low = (data[4] as u16) << 8; @@ -607,7 +607,10 @@ impl DualSenseManager { } match DualSensePad::open(idx as u8) { Ok(p) => { - tracing::info!(index = idx, "virtual DualSense created (UHID hid-playstation)"); + tracing::info!( + index = idx, + "virtual DualSense created (UHID hid-playstation)" + ); self.pads[idx] = Some(p); self.state[idx] = DsState::neutral(); self.last_rumble[idx] = (0, 0); @@ -744,8 +747,8 @@ mod tests { assert_eq!(&r[16..22], &[0x22, 0x11, 0x44, 0x33, 0x66, 0x55]); // gyro LE assert_eq!(&r[22..28], &[0x78, 0x07, 0x9A, 0x09, 0xBC, 0x0B]); // accel LE assert_eq!(&r[28..32], &[0xDD, 0xCC, 0xBB, 0xAA]); // sensor_timestamp LE - // Touch point 1 at struct off 32 = r[33..37]: contact byte (active → bit7 clear), - // then 12-bit x / 12-bit y packed. + // Touch point 1 at struct off 32 = r[33..37]: contact byte (active → bit7 clear), + // then 12-bit x / 12-bit y packed. assert_eq!(r[33], 5); assert_eq!(r[34], 0x23); assert_eq!(r[35], 0x61); // x_hi nibble 0x1 | (y & 0xF) << 4 (y=0x356 → 0x6 << 4)