From 86456ce37924407c23c9237c147fd7773fb66d7b Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Thu, 25 Jul 2024 20:22:01 +0200 Subject: [PATCH] chore: Fix clippy violations from Cargo.toml (#15216) /cc @maxdeviant Release Notes: - N/A --- Cargo.toml | 7 ---- .../src/slash_command/docs_command.rs | 2 +- crates/call/src/room.rs | 4 +-- crates/collab/src/tests/following_tests.rs | 1 + crates/copilot/src/copilot.rs | 2 +- .../src/copilot_completion_provider.rs | 32 ++++++++--------- crates/editor/src/element.rs | 5 +-- crates/extension/src/extension_store_test.rs | 1 + crates/gpui/src/elements/div.rs | 6 ++-- crates/gpui/src/platform/test/platform.rs | 2 +- crates/gpui/src/platform/test/window.rs | 4 +-- crates/gpui/src/window.rs | 2 +- crates/language/src/buffer_tests.rs | 2 +- crates/language/src/syntax_map.rs | 29 ++++++++------- crates/live_kit_client/src/test.rs | 36 +++++++++---------- .../markdown_preview/src/markdown_parser.rs | 4 +-- crates/search/src/buffer_search.rs | 16 ++++----- crates/semantic_index/src/semantic_index.rs | 2 +- crates/terminal_view/src/terminal_element.rs | 8 ++--- crates/terminal_view/src/terminal_view.rs | 5 +-- crates/text/src/patch.rs | 1 + crates/ui/src/components/context_menu.rs | 4 +-- crates/vim/src/normal/repeat.rs | 6 ++-- crates/vim/src/normal/search.rs | 2 +- crates/workspace/src/pane.rs | 4 +-- 25 files changed, 94 insertions(+), 93 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 24e0b0d2cb..5f5de1f831 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -537,13 +537,6 @@ single_range_in_vec_init = "allow" style = { level = "allow", priority = -1 } # Individual rules that have violations in the codebase: -almost_complete_range = "allow" -arc_with_non_send_sync = "allow" -borrowed_box = "allow" -let_underscore_future = "allow" -map_entry = "allow" -non_canonical_partial_ord_impl = "allow" -reversed_empty_ranges = "allow" type_complexity = "allow" [workspace.metadata.cargo-machete] diff --git a/crates/assistant/src/slash_command/docs_command.rs b/crates/assistant/src/slash_command/docs_command.rs index 90db4a5e19..567d280eb7 100644 --- a/crates/assistant/src/slash_command/docs_command.rs +++ b/crates/assistant/src/slash_command/docs_command.rs @@ -219,7 +219,7 @@ impl SlashCommand for DocsSlashCommand { if index { // We don't need to hold onto this task, as the `IndexedDocsStore` will hold it // until it completes. - let _ = store.clone().index(package.as_str().into()); + drop(store.clone().index(package.as_str().into())); } let items = store.search(package).await; diff --git a/crates/call/src/room.rs b/crates/call/src/room.rs index bafbc26447..a92c9fb6e1 100644 --- a/crates/call/src/room.rs +++ b/crates/call/src/room.rs @@ -493,7 +493,7 @@ impl Room { // we leave the room and return an error. if let Some(this) = this.upgrade() { log::info!("reconnection failed, leaving room"); - let _ = this.update(&mut cx, |this, cx| this.leave(cx))?; + let _ = this.update(&mut cx, |this, cx| this.leave(cx))?.await?; } Err(anyhow!( "can't reconnect to room: client failed to re-establish connection" @@ -942,7 +942,7 @@ impl Room { this.pending_room_update.take(); if this.should_leave() { log::info!("room is empty, leaving"); - let _ = this.leave(cx); + let _ = this.leave(cx).detach(); } this.user_store.update(cx, |user_store, cx| { diff --git a/crates/collab/src/tests/following_tests.rs b/crates/collab/src/tests/following_tests.rs index 8c27fb401a..ba305fb52d 100644 --- a/crates/collab/src/tests/following_tests.rs +++ b/crates/collab/src/tests/following_tests.rs @@ -1,3 +1,4 @@ +#![allow(clippy::reversed_empty_ranges)] use crate::{rpc::RECONNECT_TIMEOUT, tests::TestServer}; use call::{ActiveCall, ParticipantLocation}; use client::ChannelId; diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rs index 71a0679e66..c1d482455a 100644 --- a/crates/copilot/src/copilot.rs +++ b/crates/copilot/src/copilot.rs @@ -691,7 +691,7 @@ impl Copilot { { match event { language::Event::Edited => { - let _ = registered_buffer.report_changes(&buffer, cx); + drop(registered_buffer.report_changes(&buffer, cx)); } language::Event::Saved => { server diff --git a/crates/copilot/src/copilot_completion_provider.rs b/crates/copilot/src/copilot_completion_provider.rs index c9d254f51b..c85c332e58 100644 --- a/crates/copilot/src/copilot_completion_provider.rs +++ b/crates/copilot/src/copilot_completion_provider.rs @@ -333,7 +333,7 @@ mod tests { three "}); cx.simulate_keystroke("."); - let _ = handle_completion_request( + drop(handle_completion_request( &mut cx, indoc! {" one.|<> @@ -341,7 +341,7 @@ mod tests { three "}, vec!["completion_a", "completion_b"], - ); + )); handle_copilot_completion_request( &copilot_lsp, vec![crate::request::Completion { @@ -375,7 +375,7 @@ mod tests { three "}); cx.simulate_keystroke("."); - let _ = handle_completion_request( + drop(handle_completion_request( &mut cx, indoc! {" one.|<> @@ -383,7 +383,7 @@ mod tests { three "}, vec![], - ); + )); handle_copilot_completion_request( &copilot_lsp, vec![crate::request::Completion { @@ -408,7 +408,7 @@ mod tests { three "}); cx.simulate_keystroke("."); - let _ = handle_completion_request( + drop(handle_completion_request( &mut cx, indoc! {" one.|<> @@ -416,7 +416,7 @@ mod tests { three "}, vec!["completion_a", "completion_b"], - ); + )); handle_copilot_completion_request( &copilot_lsp, vec![crate::request::Completion { @@ -590,7 +590,7 @@ mod tests { three "}); cx.simulate_keystroke("."); - let _ = handle_completion_request( + drop(handle_completion_request( &mut cx, indoc! {" one.|<> @@ -598,7 +598,7 @@ mod tests { three "}, vec![], - ); + )); handle_copilot_completion_request( &copilot_lsp, vec![crate::request::Completion { @@ -632,7 +632,7 @@ mod tests { three "}); cx.simulate_keystroke("."); - let _ = handle_completion_request( + drop(handle_completion_request( &mut cx, indoc! {" one.|<> @@ -640,7 +640,7 @@ mod tests { three "}, vec![], - ); + )); handle_copilot_completion_request( &copilot_lsp, vec![crate::request::Completion { @@ -889,7 +889,7 @@ mod tests { three "}); - let _ = handle_completion_request( + drop(handle_completion_request( &mut cx, indoc! {" one @@ -897,7 +897,7 @@ mod tests { three "}, vec!["completion_a", "completion_b"], - ); + )); handle_copilot_completion_request( &copilot_lsp, vec![crate::request::Completion { @@ -917,7 +917,7 @@ mod tests { }); cx.simulate_keystroke("o"); - let _ = handle_completion_request( + drop(handle_completion_request( &mut cx, indoc! {" one @@ -925,7 +925,7 @@ mod tests { three "}, vec!["completion_a_2", "completion_b_2"], - ); + )); handle_copilot_completion_request( &copilot_lsp, vec![crate::request::Completion { @@ -944,7 +944,7 @@ mod tests { }); cx.simulate_keystroke("."); - let _ = handle_completion_request( + drop(handle_completion_request( &mut cx, indoc! {" one @@ -952,7 +952,7 @@ mod tests { three "}, vec!["something_else()"], - ); + )); handle_copilot_completion_request( &copilot_lsp, vec![crate::request::Completion { diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 2deae35d3d..dc28c5952e 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -59,6 +59,7 @@ use std::{ fmt::{self, Write}, iter, mem, ops::{Deref, Range}, + rc::Rc, sync::Arc, }; use sum_tree::Bias; @@ -5492,7 +5493,7 @@ impl Element for EditorElement { EditorLayout { mode: snapshot.mode, - position_map: Arc::new(PositionMap { + position_map: Rc::new(PositionMap { size: bounds.size, scroll_pixel_position, scroll_max, @@ -5642,7 +5643,7 @@ impl IntoElement for EditorElement { } pub struct EditorLayout { - position_map: Arc, + position_map: Rc, hitbox: Hitbox, text_hitbox: Hitbox, gutter_hitbox: Hitbox, diff --git a/crates/extension/src/extension_store_test.rs b/crates/extension/src/extension_store_test.rs index 61e6bc3eec..d4227c05f9 100644 --- a/crates/extension/src/extension_store_test.rs +++ b/crates/extension/src/extension_store_test.rs @@ -363,6 +363,7 @@ async fn test_extension_store(cx: &mut TestAppContext) { }, ); + #[allow(clippy::let_underscore_future)] let _ = store.update(cx, |store, cx| store.reload(None, cx)); cx.executor().advance_clock(RELOAD_DEBOUNCE_DURATION); diff --git a/crates/gpui/src/elements/div.rs b/crates/gpui/src/elements/div.rs index 6979b58567..2773c4c256 100644 --- a/crates/gpui/src/elements/div.rs +++ b/crates/gpui/src/elements/div.rs @@ -323,14 +323,14 @@ impl Interactivity { pub fn on_boxed_action( &mut self, action: &dyn Action, - listener: impl Fn(&Box, &mut WindowContext) + 'static, + listener: impl Fn(&dyn Action, &mut WindowContext) + 'static, ) { let action = action.boxed_clone(); self.action_listeners.push(( (*action).type_id(), Box::new(move |_, phase, cx| { if phase == DispatchPhase::Bubble { - (listener)(&action, cx) + (listener)(&*action, cx) } }), )); @@ -757,7 +757,7 @@ pub trait InteractiveElement: Sized { fn on_boxed_action( mut self, action: &dyn Action, - listener: impl Fn(&Box, &mut WindowContext) + 'static, + listener: impl Fn(&dyn Action, &mut WindowContext) + 'static, ) -> Self { self.interactivity().on_boxed_action(action, listener); self diff --git a/crates/gpui/src/platform/test/platform.rs b/crates/gpui/src/platform/test/platform.rs index d26317f50e..31f48511d7 100644 --- a/crates/gpui/src/platform/test/platform.rs +++ b/crates/gpui/src/platform/test/platform.rs @@ -115,7 +115,7 @@ impl TestPlatform { .spawn(async move { if let Some(previous_window) = previous_window { if let Some(window) = window.as_ref() { - if Arc::ptr_eq(&previous_window.0, &window.0) { + if Rc::ptr_eq(&previous_window.0, &window.0) { return; } } diff --git a/crates/gpui/src/platform/test/window.rs b/crates/gpui/src/platform/test/window.rs index 79a1c04401..f79421b12a 100644 --- a/crates/gpui/src/platform/test/window.rs +++ b/crates/gpui/src/platform/test/window.rs @@ -31,7 +31,7 @@ pub(crate) struct TestWindowState { } #[derive(Clone)] -pub(crate) struct TestWindow(pub(crate) Arc>); +pub(crate) struct TestWindow(pub(crate) Rc>); impl HasWindowHandle for TestWindow { fn window_handle( @@ -56,7 +56,7 @@ impl TestWindow { platform: Weak, display: Rc, ) -> Self { - Self(Arc::new(Mutex::new(TestWindowState { + Self(Rc::new(Mutex::new(TestWindowState { bounds: params.bounds, display, platform, diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs index 4b2ebcbda1..6283dd354b 100644 --- a/crates/gpui/src/window.rs +++ b/crates/gpui/src/window.rs @@ -4419,7 +4419,7 @@ impl<'a, V: 'static> ViewContext<'a, V> { /// Many GPUI callbacks take the form of `Fn(&E, &mut WindowContext)`, /// but it's often useful to be able to access view state in these /// callbacks. This method provides a convenient way to do so. - pub fn listener( + pub fn listener( &self, f: impl Fn(&mut V, &E, &mut ViewContext) + 'static, ) -> impl Fn(&E, &mut WindowContext) + 'static { diff --git a/crates/language/src/buffer_tests.rs b/crates/language/src/buffer_tests.rs index e2f5b011e2..f303ee93dd 100644 --- a/crates/language/src/buffer_tests.rs +++ b/crates/language/src/buffer_tests.rs @@ -2463,7 +2463,7 @@ fn test_trailing_whitespace_ranges(mut rng: StdRng) { text.push(match rng.gen_range(0..10) { 0..=1 => ' ', 3 => '\t', - _ => rng.gen_range('a'..'z'), + _ => rng.gen_range('a'..='z'), }); } text.push('\n'); diff --git a/crates/language/src/syntax_map.rs b/crates/language/src/syntax_map.rs index cdc6d14259..f781cb48c0 100644 --- a/crates/language/src/syntax_map.rs +++ b/crates/language/src/syntax_map.rs @@ -1334,7 +1334,7 @@ pub(crate) fn splice_included_ranges( let mut removed_ranges = removed_ranges.iter().cloned().peekable(); let mut new_ranges = new_ranges.into_iter().cloned().peekable(); let mut ranges_ix = 0; - let mut changed_portion = usize::MAX..0; + let mut changed_portion: Option> = None; loop { let next_new_range = new_ranges.peek(); let next_removed_range = removed_ranges.peek(); @@ -1395,23 +1395,26 @@ pub(crate) fn splice_included_ranges( break; } } - - changed_portion.start = changed_portion.start.min(start_ix); - changed_portion.end = changed_portion.end.max(if insert.is_some() { - start_ix + 1 - } else { - start_ix - }); + let changed_start = changed_portion + .as_ref() + .map_or(usize::MAX, |range| range.start) + .min(start_ix); + let changed_end = + changed_portion + .as_ref() + .map_or(0, |range| range.end) + .max(if insert.is_some() { + start_ix + 1 + } else { + start_ix + }); + changed_portion = Some(changed_start..changed_end); ranges.splice(start_ix..end_ix, insert); ranges_ix = start_ix; } - if changed_portion.end < changed_portion.start { - changed_portion = 0..0; - } - - (ranges, changed_portion) + (ranges, changed_portion.unwrap_or(0..0)) } /// Ensure there are newline ranges in between content range that appear on diff --git a/crates/live_kit_client/src/test.rs b/crates/live_kit_client/src/test.rs index bfe36cece1..a0193478dd 100644 --- a/crates/live_kit_client/src/test.rs +++ b/crates/live_kit_client/src/test.rs @@ -1,7 +1,7 @@ use crate::{ConnectionState, RoomUpdate, Sid}; use anyhow::{anyhow, Context, Result}; use async_trait::async_trait; -use collections::{BTreeMap, HashMap, HashSet}; +use collections::{btree_map::Entry as BTreeEntry, hash_map::Entry, BTreeMap, HashMap, HashSet}; use futures::Stream; use gpui::{BackgroundExecutor, ImageSource}; use live_kit_server::{proto, token}; @@ -35,18 +35,18 @@ impl TestServer { executor: BackgroundExecutor, ) -> Result> { let mut servers = SERVERS.lock(); - if servers.contains_key(&url) { - Err(anyhow!("a server with url {:?} already exists", url)) - } else { + if let BTreeEntry::Vacant(e) = servers.entry(url.clone()) { let server = Arc::new(TestServer { - url: url.clone(), + url, api_key, secret_key, rooms: Default::default(), executor, }); - servers.insert(url, server.clone()); + e.insert(server.clone()); Ok(server) + } else { + Err(anyhow!("a server with url {:?} already exists", url)) } } @@ -77,11 +77,11 @@ impl TestServer { #[cfg(any(test, feature = "test-support"))] self.executor.simulate_random_delay().await; let mut server_rooms = self.rooms.lock(); - if server_rooms.contains_key(&room) { - Err(anyhow!("room {:?} already exists", room)) - } else { - server_rooms.insert(room, Default::default()); + if let Entry::Vacant(e) = server_rooms.entry(room.clone()) { + e.insert(Default::default()); Ok(()) + } else { + Err(anyhow!("room {:?} already exists", room)) } } @@ -108,13 +108,7 @@ impl TestServer { let mut server_rooms = self.rooms.lock(); let room = (*server_rooms).entry(room_name.to_string()).or_default(); - if room.client_rooms.contains_key(&identity) { - Err(anyhow!( - "{:?} attempted to join room {:?} twice", - identity, - room_name - )) - } else { + if let Entry::Vacant(e) = room.client_rooms.entry(identity.clone()) { for track in &room.video_tracks { client_room .0 @@ -141,8 +135,14 @@ impl TestServer { )) .unwrap(); } - room.client_rooms.insert(identity, client_room); + e.insert(client_room); Ok(()) + } else { + Err(anyhow!( + "{:?} attempted to join room {:?} twice", + identity, + room_name + )) } } diff --git a/crates/markdown_preview/src/markdown_parser.rs b/crates/markdown_preview/src/markdown_parser.rs index 27a5e53245..fcbf7c1e96 100644 --- a/crates/markdown_preview/src/markdown_parser.rs +++ b/crates/markdown_preview/src/markdown_parser.rs @@ -500,8 +500,8 @@ impl<'a> MarkdownParser<'a> { // We will use the start of the nested list as the end for the current item's range, // because we don't care about the hierarchy of list items - if !source_ranges.contains_key(&depth) { - source_ranges.insert(depth, start_item_range.start..source_range.start); + if let collections::hash_map::Entry::Vacant(e) = source_ranges.entry(depth) { + e.insert(start_item_range.start..source_range.start); } order_stack.push(order); diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 51e58e5d01..50a50171bf 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -437,7 +437,7 @@ impl ToolbarItemView for BufferSearchBar { )); self.active_searchable_item = Some(searchable_item_handle); - let _ = self.update_matches(cx); + drop(self.update_matches(cx)); if !self.dismissed { return ToolbarItemLocation::Secondary; } @@ -719,7 +719,7 @@ impl BufferSearchBar { fn toggle_search_option(&mut self, search_option: SearchOptions, cx: &mut ViewContext) { self.search_options.toggle(search_option); self.default_options = self.search_options; - let _ = self.update_matches(cx); + drop(self.update_matches(cx)); cx.notify(); } @@ -856,7 +856,7 @@ impl BufferSearchBar { fn on_active_searchable_item_event(&mut self, event: &SearchEvent, cx: &mut ViewContext) { match event { SearchEvent::MatchesInvalidated => { - let _ = self.update_matches(cx); + drop(self.update_matches(cx)); } SearchEvent::ActiveMatchChanged => self.update_match_index(cx), } @@ -874,7 +874,7 @@ impl BufferSearchBar { if let Some(active_item) = self.active_searchable_item.as_mut() { self.selection_search_enabled = !self.selection_search_enabled; active_item.toggle_filtered_search_ranges(self.selection_search_enabled, cx); - let _ = self.update_matches(cx); + drop(self.update_matches(cx)); cx.notify(); } } @@ -1047,10 +1047,10 @@ impl BufferSearchBar { .next(&mut self.search_history_cursor) .map(str::to_string) { - let _ = self.search(&new_query, Some(self.search_options), cx); + drop(self.search(&new_query, Some(self.search_options), cx)); } else { self.search_history_cursor.reset(); - let _ = self.search("", Some(self.search_options), cx); + drop(self.search("", Some(self.search_options), cx)); } } @@ -1061,7 +1061,7 @@ impl BufferSearchBar { .current(&mut self.search_history_cursor) .map(str::to_string) { - let _ = self.search(&new_query, Some(self.search_options), cx); + drop(self.search(&new_query, Some(self.search_options), cx)); return; } } @@ -1071,7 +1071,7 @@ impl BufferSearchBar { .previous(&mut self.search_history_cursor) .map(str::to_string) { - let _ = self.search(&new_query, Some(self.search_options), cx); + drop(self.search(&new_query, Some(self.search_options), cx)); } } diff --git a/crates/semantic_index/src/semantic_index.rs b/crates/semantic_index/src/semantic_index.rs index 471c58b5bf..23a04a47eb 100644 --- a/crates/semantic_index/src/semantic_index.rs +++ b/crates/semantic_index/src/semantic_index.rs @@ -1192,7 +1192,7 @@ mod tests { Err(anyhow!("cannot embed text containing a 'g' character")) } else { Ok(Embedding::new( - ('a'..'z') + ('a'..='z') .map(|char| text.chars().filter(|c| *c == char).count() as f32) .collect(), )) diff --git a/crates/terminal_view/src/terminal_element.rs b/crates/terminal_view/src/terminal_element.rs index c6b5a3fc27..b48f603203 100644 --- a/crates/terminal_view/src/terminal_element.rs +++ b/crates/terminal_view/src/terminal_element.rs @@ -27,8 +27,8 @@ use theme::{ActiveTheme, Theme, ThemeSettings}; use ui::{ParentElement, Tooltip}; use workspace::Workspace; -use std::{fmt::Debug, ops::RangeInclusive}; -use std::{mem, sync::Arc}; +use std::mem; +use std::{fmt::Debug, ops::RangeInclusive, rc::Rc}; use crate::{BlockContext, BlockProperties, TerminalView}; @@ -156,7 +156,7 @@ pub struct TerminalElement { cursor_visible: bool, can_navigate_to_selected_word: bool, interactivity: Interactivity, - block_below_cursor: Option>, + block_below_cursor: Option>, } impl InteractiveElement for TerminalElement { @@ -177,7 +177,7 @@ impl TerminalElement { focused: bool, cursor_visible: bool, can_navigate_to_selected_word: bool, - block_below_cursor: Option>, + block_below_cursor: Option>, ) -> TerminalElement { TerminalElement { terminal, diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index a525459c64..804bc96dc7 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/crates/terminal_view/src/terminal_view.rs @@ -47,6 +47,7 @@ use std::{ cmp, ops::RangeInclusive, path::{Path, PathBuf}, + rc::Rc, sync::Arc, time::Duration, }; @@ -106,7 +107,7 @@ pub struct TerminalView { can_navigate_to_selected_word: bool, workspace_id: Option, show_title: bool, - block_below_cursor: Option>, + block_below_cursor: Option>, scroll_top: Pixels, _subscriptions: Vec, _terminal_subscriptions: Vec, @@ -459,7 +460,7 @@ impl TerminalView { } pub fn set_block_below_cursor(&mut self, block: BlockProperties, cx: &mut ViewContext) { - self.block_below_cursor = Some(Arc::new(block)); + self.block_below_cursor = Some(Rc::new(block)); self.scroll_to_bottom(&ScrollToBottom, cx); cx.notify(); } diff --git a/crates/text/src/patch.rs b/crates/text/src/patch.rs index f10acbc2d3..bb71a80c51 100644 --- a/crates/text/src/patch.rs +++ b/crates/text/src/patch.rs @@ -562,6 +562,7 @@ mod tests { } #[track_caller] + #[allow(clippy::almost_complete_range)] fn assert_patch_composition(old: Patch, new: Patch, composed: Patch) { let original = ('a'..'z').collect::>(); let inserted = ('A'..'Z').collect::>(); diff --git a/crates/ui/src/components/context_menu.rs b/crates/ui/src/components/context_menu.rs index 8d0fc06114..918b160c3c 100644 --- a/crates/ui/src/components/context_menu.rs +++ b/crates/ui/src/components/context_menu.rs @@ -250,7 +250,7 @@ impl ContextMenu { } } - pub fn on_action_dispatch(&mut self, dispatched: &Box, cx: &mut ViewContext) { + pub fn on_action_dispatch(&mut self, dispatched: &dyn Action, cx: &mut ViewContext) { if self.clicked { cx.propagate(); return; @@ -262,7 +262,7 @@ impl ContextMenu { .. } = item { - action.partial_eq(&**dispatched) + action.partial_eq(dispatched) } else { false } diff --git a/crates/vim/src/normal/repeat.rs b/crates/vim/src/normal/repeat.rs index fd4365b006..78ae5b9ec4 100644 --- a/crates/vim/src/normal/repeat.rs +++ b/crates/vim/src/normal/repeat.rs @@ -13,9 +13,9 @@ use workspace::Workspace; actions!(vim, [Repeat, EndRepeat, ToggleRecord, ReplayLastRecording]); -fn should_replay(action: &Box) -> bool { +fn should_replay(action: &dyn Action) -> bool { // skip so that we don't leave the character palette open - if editor::actions::ShowCharacterPalette.partial_eq(&**action) { + if editor::actions::ShowCharacterPalette.partial_eq(action) { return false; } true @@ -121,7 +121,7 @@ impl Replayer { }; match action { ReplayableAction::Action(action) => { - if should_replay(&action) { + if should_replay(&*action) { cx.dispatch_action(action.boxed_clone()); cx.defer(move |cx| observe_action(action.boxed_clone(), cx)); } diff --git a/crates/vim/src/normal/search.rs b/crates/vim/src/normal/search.rs index 7356faf1ec..4e2535a367 100644 --- a/crates/vim/src/normal/search.rs +++ b/crates/vim/src/normal/search.rs @@ -271,7 +271,7 @@ pub fn move_to_internal( } let Some(query) = search_bar.query_suggestion(cx) else { vim.clear_operator(cx); - let _ = search_bar.search("", None, cx); + drop(search_bar.search("", None, cx)); return None; }; let mut query = regex::escape(&query); diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 39743c8ba8..a8e83e7f49 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -1571,7 +1571,7 @@ impl Pane { fn render_tab( &self, ix: usize, - item: &Box, + item: &dyn ItemHandle, detail: usize, cx: &mut ViewContext<'_, Pane>, ) -> impl IntoElement { @@ -1863,7 +1863,7 @@ impl Pane { .iter() .enumerate() .zip(tab_details(&self.items, cx)) - .map(|((ix, item), detail)| self.render_tab(ix, item, detail, cx)), + .map(|((ix, item), detail)| self.render_tab(ix, &**item, detail, cx)), ) .child( div()