Fix clippy lints that don't currently appear in CI (#27944)

I may have a newer version of clippy than CI. Also removes some unused
code in `livekit_client.rs`

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-04-02 12:00:16 -06:00 committed by GitHub
parent f8092bf0d2
commit 142f9917d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 37 deletions

View file

@ -19,7 +19,7 @@ use livekit_client::{self as livekit, TrackSid};
use postage::{sink::Sink, stream::Stream, watch}; use postage::{sink::Sink, stream::Stream, watch};
use project::Project; use project::Project;
use settings::Settings as _; use settings::Settings as _;
use std::{any::Any, future::Future, mem, sync::Arc, time::Duration}; use std::{any::Any, future::Future, mem, rc::Rc, sync::Arc, time::Duration};
use util::{ResultExt, TryFutureExt, post_inc}; use util::{ResultExt, TryFutureExt, post_inc};
pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30);
@ -1594,7 +1594,7 @@ fn spawn_room_connection(
let muted_by_user = Room::mute_on_join(cx); let muted_by_user = Room::mute_on_join(cx);
this.live_kit = Some(LiveKitRoom { this.live_kit = Some(LiveKitRoom {
room: Arc::new(room), room: Rc::new(room),
screen_track: LocalTrack::None, screen_track: LocalTrack::None,
microphone_track: LocalTrack::None, microphone_track: LocalTrack::None,
next_publish_id: 0, next_publish_id: 0,
@ -1617,7 +1617,7 @@ fn spawn_room_connection(
} }
struct LiveKitRoom { struct LiveKitRoom {
room: Arc<livekit::Room>, room: Rc<livekit::Room>,
screen_track: LocalTrack, screen_track: LocalTrack,
microphone_track: LocalTrack, microphone_track: LocalTrack,
/// Tracks whether we're currently in a muted state due to auto-mute from deafening or manual mute performed by user. /// Tracks whether we're currently in a muted state due to auto-mute from deafening or manual mute performed by user.

View file

@ -61,7 +61,7 @@ impl Room {
let task = cx.background_executor().spawn(async move { let task = cx.background_executor().spawn(async move {
while let Some(event) = events.recv().await { while let Some(event) = events.recv().await {
if let Some(event) = room_event_from_livekit(event) { if let Some(event) = room_event_from_livekit(event) {
tx.send(event.into()).await.ok(); tx.send(event).await.ok();
} }
} }
}); });
@ -112,33 +112,6 @@ impl Room {
Ok((publication, stream)) Ok((publication, stream))
} }
// pub async fn publish_local_wav_track(
// &self,
// cx: &mut AsyncApp,
// ) -> Result<(LocalTrackPublication, playback::AudioStream)> {
// let apm = self.apm.clone();
// let executor = cx.background_executor().clone();
// let (track, stream) =
// Tokio::spawn(
// cx,
// async move { capture_local_wav_track(apm, &executor).await },
// )?
// .await??;
// let publication = self
// .local_participant()
// .publish_track(
// livekit::track::LocalTrack::Audio(track.0),
// livekit::options::TrackPublishOptions {
// source: livekit::track::TrackSource::Microphone,
// ..Default::default()
// },
// cx,
// )
// .await?;
// Ok((publication, stream))
// }
pub async fn unpublish_local_track( pub async fn unpublish_local_track(
&self, &self,
sid: TrackSid, sid: TrackSid,
@ -162,7 +135,7 @@ impl LocalParticipant {
source: &dyn ScreenCaptureSource, source: &dyn ScreenCaptureSource,
cx: &mut AsyncApp, cx: &mut AsyncApp,
) -> Result<(LocalTrackPublication, Box<dyn ScreenCaptureStream>)> { ) -> Result<(LocalTrackPublication, Box<dyn ScreenCaptureStream>)> {
let (track, stream) = capture_local_video_track(&*source, cx).await?; let (track, stream) = capture_local_video_track(source, cx).await?;
let options = livekit::options::TrackPublishOptions { let options = livekit::options::TrackPublishOptions {
source: livekit::track::TrackSource::Screenshare, source: livekit::track::TrackSource::Screenshare,
video_codec: livekit::options::VideoCodec::VP8, video_codec: livekit::options::VideoCodec::VP8,
@ -186,7 +159,7 @@ impl LocalParticipant {
participant.publish_track(track, options).await participant.publish_track(track, options).await
})? })?
.await? .await?
.map(|p| LocalTrackPublication(p)) .map(LocalTrackPublication)
.map_err(|error| anyhow::anyhow!("failed to publish track: {error}")) .map_err(|error| anyhow::anyhow!("failed to publish track: {error}"))
} }
@ -198,7 +171,7 @@ impl LocalParticipant {
let participant = self.0.clone(); let participant = self.0.clone();
Tokio::spawn(cx, async move { participant.unpublish_track(&sid).await })? Tokio::spawn(cx, async move { participant.unpublish_track(&sid).await })?
.await? .await?
.map(|p| LocalTrackPublication(p)) .map(LocalTrackPublication)
.map_err(|error| anyhow::anyhow!("failed to unpublish track: {error}")) .map_err(|error| anyhow::anyhow!("failed to unpublish track: {error}"))
} }
} }
@ -476,7 +449,7 @@ fn room_event_from_livekit(event: livekit::RoomEvent) -> Option<RoomEvent> {
|(p, t)| { |(p, t)| {
( (
RemoteParticipant(p), RemoteParticipant(p),
t.into_iter().map(|t| RemoteTrackPublication(t)).collect(), t.into_iter().map(RemoteTrackPublication).collect(),
) )
} }
}) })

View file

@ -271,9 +271,9 @@ impl AudioStack {
let mut sampled = resampler let mut sampled = resampler
.remix_and_resample( .remix_and_resample(
buf.as_slice(), buf.as_slice(),
config.sample_rate().0 as u32 / 100, config.sample_rate().0 / 100,
config.channels() as u32, config.channels() as u32,
config.sample_rate().0 as u32, config.sample_rate().0,
num_channels, num_channels,
sample_rate, sample_rate,
) )