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

Michael Sloan created

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

Release Notes:

- N/A

Change summary

crates/call/src/call_impl/room.rs                    |  6 +-
crates/livekit_client/src/livekit_client.rs          | 37 +------------
crates/livekit_client/src/livekit_client/playback.rs |  4 
3 files changed, 10 insertions(+), 37 deletions(-)

Detailed changes

crates/call/src/call_impl/room.rs 🔗

@@ -19,7 +19,7 @@ use livekit_client::{self as livekit, TrackSid};
 use postage::{sink::Sink, stream::Stream, watch};
 use project::Project;
 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};
 
 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);
                 this.live_kit = Some(LiveKitRoom {
-                    room: Arc::new(room),
+                    room: Rc::new(room),
                     screen_track: LocalTrack::None,
                     microphone_track: LocalTrack::None,
                     next_publish_id: 0,
@@ -1617,7 +1617,7 @@ fn spawn_room_connection(
 }
 
 struct LiveKitRoom {
-    room: Arc<livekit::Room>,
+    room: Rc<livekit::Room>,
     screen_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.

crates/livekit_client/src/livekit_client.rs 🔗

@@ -61,7 +61,7 @@ impl Room {
         let task = cx.background_executor().spawn(async move {
             while let Some(event) = events.recv().await {
                 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))
     }
 
-    // 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(
         &self,
         sid: TrackSid,
@@ -162,7 +135,7 @@ impl LocalParticipant {
         source: &dyn ScreenCaptureSource,
         cx: &mut AsyncApp,
     ) -> 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 {
             source: livekit::track::TrackSource::Screenshare,
             video_codec: livekit::options::VideoCodec::VP8,
@@ -186,7 +159,7 @@ impl LocalParticipant {
             participant.publish_track(track, options).await
         })?
         .await?
-        .map(|p| LocalTrackPublication(p))
+        .map(LocalTrackPublication)
         .map_err(|error| anyhow::anyhow!("failed to publish track: {error}"))
     }
 
@@ -198,7 +171,7 @@ impl LocalParticipant {
         let participant = self.0.clone();
         Tokio::spawn(cx, async move { participant.unpublish_track(&sid).await })?
             .await?
-            .map(|p| LocalTrackPublication(p))
+            .map(LocalTrackPublication)
             .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)| {
                         (
                             RemoteParticipant(p),
-                            t.into_iter().map(|t| RemoteTrackPublication(t)).collect(),
+                            t.into_iter().map(RemoteTrackPublication).collect(),
                         )
                     }
                 })

crates/livekit_client/src/livekit_client/playback.rs 🔗

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