From 2d71903e8f3318a2473cec807649dc9d941fd9bf Mon Sep 17 00:00:00 2001 From: faumaray Date: Wed, 21 Oct 2026 02:13:19 +0300 Subject: [PATCH] Write two loops of the seam as newer clippy wants them A nightly clippy (1.101) flags two places of the session seam that the pinned 1.94 does not: the sibling placement of ts_session/entities.rs is a while let loop, and the generated channel tree of the presence round trip in book.rs counts with its loop variable. Neither changes behaviour (the same random stream, the same ids). The remaining nightly findings are in code this branch does not touch: audio.rs and media.rs of voelin-core (chunks_exact), voice.rs (a large Err variant), voelin-audio, voelin-media and voelin-ui. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-core/src/book.rs | 5 +---- crates/voelin-core/src/ts_session/entities.rs | 17 +++++++---------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/crates/voelin-core/src/book.rs b/crates/voelin-core/src/book.rs index 8d8e23b..00db757 100644 --- a/crates/voelin-core/src/book.rs +++ b/crates/voelin-core/src/book.rs @@ -533,9 +533,8 @@ mod tests { p.channel_groups.insert(id, group(id, &mut n)); } // Channels: a tree whose siblings follow each other. - let mut next_id = 1; let mut parents = vec![0u64]; - for _ in 0..(3 + n.below(8)) { + for id in 1..=(3 + n.below(8)) { let parent = parents[n.below(parents.len() as u64) as usize]; let order = p .channels @@ -544,8 +543,6 @@ mod tests { .map(|c| c.id) .next_back() .unwrap_or(0); - let id = next_id; - next_id += 1; parents.push(id); p.channels.insert( id, diff --git a/crates/voelin-core/src/ts_session/entities.rs b/crates/voelin-core/src/ts_session/entities.rs index 91e0d5e..3e2681b 100644 --- a/crates/voelin-core/src/ts_session/entities.rs +++ b/crates/voelin-core/src/ts_session/entities.rs @@ -154,16 +154,13 @@ fn positions(channels: &BTreeMap) -> HashMap = HashSet::new(); let mut next = 0; let mut above = 0; - loop { - // The sibling whose `order` is the one placed last (lowest id first, - // so that two claiming the same place do not depend on map order). - let Some(channel) = siblings - .iter() - .filter(|c| c.order == above && !placed.contains(&c.id)) - .min_by_key(|c| c.id) - else { - break; - }; + // The sibling whose `order` is the one placed last (lowest id first, so + // that two claiming the same place do not depend on map order). + while let Some(channel) = siblings + .iter() + .filter(|c| c.order == above && !placed.contains(&c.id)) + .min_by_key(|c| c.id) + { positions.insert(channel.id, next * 1024); placed.insert(channel.id); above = channel.id;