Fix warnings

Piotr Osiewicz created

Change summary

crates/call2/src/call2.rs                                         |  9 
crates/call2/src/room.rs                                          |  9 
crates/call2/src/shared_screen.rs                                 | 20 
crates/collab_ui2/src/collab_panel.rs                             | 14 
crates/collab_ui2/src/collab_titlebar_item.rs                     | 27 
crates/collab_ui2/src/collab_ui.rs                                |  8 
crates/collab_ui2/src/notifications/incoming_call_notification.rs | 29 
7 files changed, 56 insertions(+), 60 deletions(-)

Detailed changes

crates/call2/src/call2.rs 🔗

@@ -18,7 +18,6 @@ use gpui::{
     Subscription, Task, View, ViewContext, VisualContext, WeakModel, WeakView,
 };
 pub use participant::ParticipantLocation;
-use participant::RemoteParticipant;
 use postage::watch;
 use project::Project;
 use room::Event;
@@ -666,7 +665,7 @@ impl CallHandler for Call {
             call.0.update(cx, |this, cx| {
                 this.room().map(|room| {
                     room.update(cx, |this, cx| {
-                        this.toggle_mute(cx);
+                        this.toggle_mute(cx).log_err();
                     })
                 })
             })
@@ -678,12 +677,10 @@ impl CallHandler for Call {
                 this.room().map(|room| {
                     room.update(cx, |this, cx| {
                         if this.is_screen_sharing() {
-                            dbg!("Unsharing");
-                            this.unshare_screen(cx);
+                            this.unshare_screen(cx).log_err();
                         } else {
-                            dbg!("Sharing");
                             let t = this.share_screen(cx);
-                            cx.spawn(move |_, cx| async move {
+                            cx.spawn(move |_, _| async move {
                                 t.await.log_err();
                             })
                             .detach();

crates/call2/src/room.rs 🔗

@@ -1,7 +1,4 @@
-use crate::{
-    call_settings::CallSettings,
-    participant::{LocalParticipant, ParticipantLocation, RemoteParticipant},
-};
+use crate::participant::{LocalParticipant, ParticipantLocation, RemoteParticipant};
 use anyhow::{anyhow, Result};
 use audio::{Audio, Sound};
 use client::{
@@ -21,7 +18,6 @@ use live_kit_client::{
 };
 use postage::{sink::Sink, stream::Stream, watch};
 use project::Project;
-use settings::Settings;
 use std::{future::Future, mem, sync::Arc, time::Duration};
 use util::{post_inc, ResultExt, TryFutureExt};
 
@@ -332,7 +328,8 @@ impl Room {
         }
     }
 
-    pub fn mute_on_join(cx: &AppContext) -> bool {
+    pub fn mute_on_join(_cx: &AppContext) -> bool {
+        // todo!() po: This should be uncommented, though then unmuting does not work
         false
         //CallSettings::get_global(cx).mute_on_join || client::IMPERSONATE_LOGIN.is_some()
     }

crates/call2/src/shared_screen.rs 🔗

@@ -3,19 +3,11 @@ use anyhow::Result;
 use client::{proto::PeerId, User};
 use futures::StreamExt;
 use gpui::{
-    div, img, AppContext, Div, Element, Entity, EventEmitter, FocusHandle, FocusableView,
-    ImageData, Img, MouseButton, ParentElement, Render, SharedString, Task, View, ViewContext,
-    VisualContext, WindowContext,
-};
-use smallvec::SmallVec;
-use std::{
-    borrow::Cow,
-    sync::{Arc, Weak},
-};
-use workspace::{
-    item::{Item, ItemEvent},
-    ItemNavHistory, WorkspaceId,
+    div, img, AppContext, Div, Element, EventEmitter, FocusHandle, FocusableView, ImageData,
+    ParentElement, Render, SharedString, Task, View, ViewContext, VisualContext, WindowContext,
 };
+use std::sync::{Arc, Weak};
+use workspace::{item::Item, ItemNavHistory, WorkspaceId};
 
 pub enum Event {
     Close,
@@ -65,13 +57,13 @@ impl EventEmitter<Event> for SharedScreen {}
 impl EventEmitter<workspace::item::ItemEvent> for SharedScreen {}
 
 impl FocusableView for SharedScreen {
-    fn focus_handle(&self, cx: &AppContext) -> FocusHandle {
+    fn focus_handle(&self, _: &AppContext) -> FocusHandle {
         self.focus.clone()
     }
 }
 impl Render for SharedScreen {
     type Element = Div;
-    fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
+    fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
         let frame = self.frame.clone();
         div().children(frame.map(|frame| {
             img().data(Arc::new(ImageData::new(image::ImageBuffer::new(

crates/collab_ui2/src/collab_panel.rs 🔗

@@ -302,7 +302,7 @@ pub struct CollabPanel {
     // entries: Vec<ListEntry>,
     // selection: Option<usize>,
     user_store: Model<UserStore>,
-    client: Arc<Client>,
+    _client: Arc<Client>,
     // channel_store: ModelHandle<ChannelStore>,
     // project: ModelHandle<Project>,
     // match_candidates: Vec<StringMatchCandidate>,
@@ -605,7 +605,7 @@ impl CollabPanel {
                 //                 collapsed_sections: vec![Section::Offline],
                 //                 collapsed_channels: Vec::default(),
                 _workspace: workspace.weak_handle(),
-                client: workspace.app_state().client.clone(),
+                _client: workspace.app_state().client.clone(),
                 //                 context_menu_on_selected: true,
                 //                 drag_target_channel: ChannelDragTarget::None,
                 //                 list_state,
@@ -3323,8 +3323,14 @@ impl Render for CollabPanel {
                     .child(Label::new(contact.user.github_login.clone()))
                     .on_mouse_down(gpui::MouseButton::Left, {
                         let workspace = workspace.clone();
-                        move |event, cx| {
-                            workspace.update(cx, |this, cx| this.call_state().invite(id, None, cx));
+                        move |_, cx| {
+                            workspace
+                                .update(cx, |this, cx| {
+                                    this.call_state()
+                                        .invite(id, None, cx)
+                                        .detach_and_log_err(cx)
+                                })
+                                .log_err();
                         }
                     })
             }))

crates/collab_ui2/src/collab_titlebar_item.rs 🔗

@@ -37,7 +37,7 @@ use gpui::{
 };
 use project::Project;
 use theme::ActiveTheme;
-use ui::{h_stack, Avatar, Button, ButtonVariant, Color, IconButton, KeyBinding, Label, Tooltip};
+use ui::{h_stack, Avatar, Button, ButtonVariant, Color, IconButton, KeyBinding, Tooltip};
 use util::ResultExt;
 use workspace::Workspace;
 
@@ -190,11 +190,12 @@ impl Render for CollabTitlebarItem {
                                         .child(Avatar::data(avatar.clone()).into_element())
                                         .on_mouse_down(MouseButton::Left, {
                                             let workspace = workspace.clone();
-                                            let id = peer_id.clone();
                                             move |_, cx| {
-                                                workspace.update(cx, |this, cx| {
-                                                    this.open_shared_screen(peer_id, cx);
-                                                });
+                                                workspace
+                                                    .update(cx, |this, cx| {
+                                                        this.open_shared_screen(peer_id, cx);
+                                                    })
+                                                    .log_err();
                                             }
                                         })
                                 })
@@ -215,17 +216,21 @@ impl Render for CollabTitlebarItem {
                                 .child(IconButton::new("mute-microphone", mic_icon).on_click({
                                     let workspace = workspace.clone();
                                     move |_, cx| {
-                                        workspace.update(cx, |this, cx| {
-                                            this.call_state().toggle_mute(cx);
-                                        });
+                                        workspace
+                                            .update(cx, |this, cx| {
+                                                this.call_state().toggle_mute(cx);
+                                            })
+                                            .log_err();
                                     }
                                 }))
                                 .child(IconButton::new("mute-sound", ui::Icon::AudioOn))
                                 .child(IconButton::new("screen-share", ui::Icon::Screen).on_click(
                                     move |_, cx| {
-                                        workspace.update(cx, |this, cx| {
-                                            this.call_state().toggle_screen_share(cx);
-                                        });
+                                        workspace
+                                            .update(cx, |this, cx| {
+                                                this.call_state().toggle_screen_share(cx);
+                                            })
+                                            .log_err();
                                     },
                                 ))
                                 .pl_2(),

crates/collab_ui2/src/collab_ui.rs 🔗

@@ -12,8 +12,8 @@ use std::{rc::Rc, sync::Arc};
 pub use collab_panel::CollabPanel;
 pub use collab_titlebar_item::CollabTitlebarItem;
 use gpui::{
-    point, px, AppContext, GlobalPixels, Pixels, PlatformDisplay, Point, Size, WindowBounds,
-    WindowKind, WindowOptions,
+    AppContext, GlobalPixels, Pixels, PlatformDisplay, Size, WindowBounds, WindowKind,
+    WindowOptions,
 };
 pub use panel_settings::{
     ChatPanelSettings, CollaborationPanelSettings, NotificationPanelSettings,
@@ -102,10 +102,10 @@ fn notification_window_options(
     screen: Rc<dyn PlatformDisplay>,
     window_size: Size<Pixels>,
 ) -> WindowOptions {
-    let notification_padding = Pixels::from(16.);
+    let _notification_padding = Pixels::from(16.);
 
     let screen_bounds = screen.bounds();
-    let size: Size<GlobalPixels> = window_size.into();
+    let _size: Size<GlobalPixels> = window_size.into();
 
     let bounds = gpui::Bounds::<GlobalPixels> {
         origin: screen_bounds.origin,

crates/collab_ui2/src/notifications/incoming_call_notification.rs 🔗

@@ -1,11 +1,9 @@
 use crate::notification_window_options;
 use call::{ActiveCall, IncomingCall};
-use client::proto;
 use futures::StreamExt;
 use gpui::{
-    blue, div, green, px, red, AnyElement, AppContext, Component, Context, Div, Element, Entity,
-    EventEmitter, GlobalPixels, ParentElement, Render, RenderOnce, StatefulInteractiveElement,
-    Styled, View, ViewContext, VisualContext as _, WindowHandle,
+    div, green, px, red, AppContext, Div, Element, ParentElement, Render, RenderOnce,
+    StatefulInteractiveElement, Styled, ViewContext, VisualContext as _, WindowHandle,
 };
 use std::sync::{Arc, Weak};
 use ui::{h_stack, v_stack, Avatar, Button, Label};
@@ -19,11 +17,12 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
         let mut notification_windows: Vec<WindowHandle<IncomingCallNotification>> = Vec::new();
         while let Some(incoming_call) = incoming_call.next().await {
             for window in notification_windows.drain(..) {
-                window.update(&mut cx, |this, cx| {
-                    //cx.remove_window();
-                });
-                //cx.update_window(window.into(), |this, cx| cx.remove_window());
-                //window.remove(&mut cx);
+                window
+                    .update(&mut cx, |_, _| {
+                        // todo!()
+                        //cx.remove_window();
+                    })
+                    .log_err();
             }
 
             if let Some(incoming_call) = incoming_call {
@@ -85,15 +84,14 @@ impl IncomingCallNotificationState {
         let active_call = ActiveCall::global(cx);
         if accept {
             let join = active_call.update(cx, |active_call, cx| active_call.accept_incoming(cx));
-            let caller_user_id = self.call.calling_user.id;
             let initial_project_id = self.call.initial_project.as_ref().map(|project| project.id);
             let app_state = self.app_state.clone();
             let cx: &mut AppContext = cx;
-            cx.spawn(|mut cx| async move {
+            cx.spawn(|cx| async move {
                 join.await?;
-                if let Some(project_id) = initial_project_id {
-                    cx.update(|cx| {
-                        if let Some(app_state) = app_state.upgrade() {
+                if let Some(_project_id) = initial_project_id {
+                    cx.update(|_cx| {
+                        if let Some(_app_state) = app_state.upgrade() {
                             // workspace::join_remote_project(
                             //     project_id,
                             //     caller_user_id,
@@ -102,7 +100,8 @@ impl IncomingCallNotificationState {
                             // )
                             // .detach_and_log_err(cx);
                         }
-                    });
+                    })
+                    .log_err();
                 }
                 anyhow::Ok(())
             })