Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix warnings
Piotr Osiewicz9590f253a924
diff --git a/crates/call2/src/call2.rs b/crates/call2/src/call2.rsindex 5933f7404f4..f9a7e4bcfa8 100644--- a/crates/call2/src/call2.rs+++ b/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();diff --git a/crates/call2/src/room.rs b/crates/call2/src/room.rsindex 5bba4cc7506..1f299ff6cb9 100644--- a/crates/call2/src/room.rs+++ b/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 workfalse//CallSettings::get_global(cx).mute_on_join || client::IMPERSONATE_LOGIN.is_some()}diff --git a/crates/call2/src/shared_screen.rs b/crates/call2/src/shared_screen.rsindex a281948d6f1..6f0024b63da 100644--- a/crates/call2/src/shared_screen.rs+++ b/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(diff --git a/crates/collab_ui2/src/collab_panel.rs b/crates/collab_ui2/src/collab_panel.rsindex 22a8a2cbba6..e9c17a6589d 100644--- a/crates/collab_ui2/src/collab_panel.rs+++ b/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();}})}))diff --git a/crates/collab_ui2/src/collab_titlebar_item.rs b/crates/collab_ui2/src/collab_titlebar_item.rsindex 9386d3ff35e..25a4db8c90f 100644--- a/crates/collab_ui2/src/collab_titlebar_item.rs+++ b/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(),diff --git a/crates/collab_ui2/src/collab_ui.rs b/crates/collab_ui2/src/collab_ui.rsindex d1e4bea7d62..679a6a135b1 100644--- a/crates/collab_ui2/src/collab_ui.rs+++ b/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,diff --git a/crates/collab_ui2/src/notifications/incoming_call_notification.rs b/crates/collab_ui2/src/notifications/incoming_call_notification.rsindex f47fcf07515..b139afcc2f4 100644--- a/crates/collab_ui2/src/notifications/incoming_call_notification.rs+++ b/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(())})