Remove warnigns

Conrad Irwin created

Change summary

crates/editor2/src/editor.rs        | 7 -------
crates/vim2/src/command.rs          | 2 +-
crates/vim2/src/editor_events.rs    | 9 ++-------
crates/vim2/src/insert.rs           | 2 +-
crates/vim2/src/mode_indicator.rs   | 4 ++--
crates/vim2/src/motion.rs           | 4 ++--
crates/vim2/src/normal.rs           | 1 -
crates/vim2/src/normal/increment.rs | 4 ++--
crates/vim2/src/normal/repeat.rs    | 2 +-
crates/vim2/src/normal/scroll.rs    | 4 ++--
crates/vim2/src/normal/search.rs    | 6 +++---
crates/vim2/src/object.rs           | 4 ++--
crates/vim2/src/vim.rs              | 4 ++--
crates/vim2/src/visual.rs           | 4 ++--
14 files changed, 22 insertions(+), 35 deletions(-)

Detailed changes

crates/editor2/src/editor.rs 🔗

@@ -9097,9 +9097,6 @@ impl Editor {
     }
 
     pub fn handle_blur(&mut self, cx: &mut ViewContext<Self>) {
-        // todo!()
-        // let blurred_event = EditorBlurred(cx.handle());
-        // cx.emit_global(blurred_event);
         self.blink_manager.update(cx, BlinkManager::disable);
         self.buffer
             .update(cx, |buffer, cx| buffer.remove_active_selections(cx));
@@ -9283,10 +9280,6 @@ pub enum EditorEvent {
     Closed,
 }
 
-pub struct EditorFocused(pub View<Editor>);
-pub struct EditorBlurred(pub View<Editor>);
-pub struct EditorReleased(pub WeakView<Editor>);
-
 impl EventEmitter<EditorEvent> for Editor {}
 
 impl FocusableView for Editor {

crates/vim2/src/command.rs 🔗

@@ -22,7 +22,7 @@ pub struct GoToLine {
 
 impl_actions!(vim, [GoToLine]);
 
-pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
+pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
     workspace.register_action(|_: &mut Workspace, action: &GoToLine, cx| {
         Vim::update(cx, |vim, cx| {
             vim.switch_mode(Mode::Normal, false, cx);

crates/vim2/src/editor_events.rs 🔗

@@ -1,7 +1,6 @@
 use crate::Vim;
-use editor::{Editor, EditorBlurred, EditorEvent, EditorFocused, EditorReleased};
+use editor::{Editor, EditorEvent};
 use gpui::{AppContext, Entity, EntityId, View, ViewContext, WindowContext};
-use workspace::item::WeakItemHandle;
 
 pub fn init(cx: &mut AppContext) {
     cx.observe_new_views(|_, cx: &mut ViewContext<Editor>| {
@@ -17,14 +16,10 @@ pub fn init(cx: &mut AppContext) {
         cx.on_release(move |_, cx| released(id, cx)).detach();
     })
     .detach();
-    // todo!()
-    // cx.subscribe_global(focused).detach();
-    // cx.subscribe_global(blurred).detach();
-    // cx.subscribe_global(released).detach();
 }
 
 fn focused(editor: View<Editor>, cx: &mut WindowContext) {
-    if let Some(previously_active_editor) = Vim::read(cx).active_editor.clone() {
+    if Vim::read(cx).active_editor.clone().is_some() {
         Vim::update(cx, |vim, cx| {
             vim.update_active_editor(cx, |previously_active_editor, cx| {
                 vim.unhook_vim_settings(previously_active_editor, cx)

crates/vim2/src/insert.rs 🔗

@@ -6,7 +6,7 @@ use workspace::Workspace;
 
 actions!(vim, [NormalBefore]);
 
-pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
+pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
     workspace.register_action(normal_before);
 }
 

crates/vim2/src/mode_indicator.rs 🔗

@@ -1,4 +1,4 @@
-use gpui::{div, AnyElement, Div, Element, Entity, IntoElement, Render, Subscription, ViewContext};
+use gpui::{div, AnyElement, Element, IntoElement, Render, ViewContext};
 use settings::{Settings, SettingsStore};
 use workspace::{item::ItemHandle, ui::Label, StatusItemView};
 
@@ -51,7 +51,7 @@ impl ModeIndicator {
 impl Render for ModeIndicator {
     type Element = AnyElement;
 
-    fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement {
+    fn render(&mut self, _: &mut ViewContext<Self>) -> AnyElement {
         let Some(mode) = self.mode.as_ref() else {
             return div().into_any();
         };

crates/vim2/src/motion.rs 🔗

@@ -4,7 +4,7 @@ use editor::{
     movement::{self, find_boundary, find_preceding_boundary, FindRange, TextLayoutDetails},
     Bias, CharKind, DisplayPoint, ToOffset,
 };
-use gpui::{actions, impl_actions, px, AppContext, ViewContext, WindowContext};
+use gpui::{actions, impl_actions, px, ViewContext, WindowContext};
 use language::{Point, Selection, SelectionGoal};
 use serde::Deserialize;
 use workspace::Workspace;
@@ -139,7 +139,7 @@ actions!(
     ]
 );
 
-pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
+pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
     workspace.register_action(|_: &mut Workspace, _: &Left, cx: _| motion(Motion::Left, cx));
     workspace
         .register_action(|_: &mut Workspace, _: &Backspace, cx: _| motion(Motion::Backspace, cx));

crates/vim2/src/normal.rs 🔗

@@ -53,7 +53,6 @@ actions!(
 );
 
 pub(crate) fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
-    dbg!("registering");
     workspace.register_action(insert_after);
     workspace.register_action(insert_before);
     workspace.register_action(insert_first_non_whitespace);

crates/vim2/src/normal/increment.rs 🔗

@@ -1,7 +1,7 @@
 use std::ops::Range;
 
 use editor::{scroll::autoscroll::Autoscroll, MultiBufferSnapshot, ToOffset, ToPoint};
-use gpui::{impl_actions, AppContext, ViewContext, WindowContext};
+use gpui::{impl_actions, ViewContext, WindowContext};
 use language::{Bias, Point};
 use serde::Deserialize;
 use workspace::Workspace;
@@ -24,7 +24,7 @@ struct Decrement {
 
 impl_actions!(vim, [Increment, Decrement]);
 
-pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
+pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
     workspace.register_action(|_: &mut Workspace, action: &Increment, cx| {
         Vim::update(cx, |vim, cx| {
             vim.record_current_action(cx);

crates/vim2/src/normal/repeat.rs 🔗

@@ -5,7 +5,7 @@ use crate::{
     visual::visual_motion,
     Vim,
 };
-use gpui::{actions, Action, AppContext, ViewContext, WindowContext};
+use gpui::{actions, Action, ViewContext, WindowContext};
 use workspace::Workspace;
 
 actions!(vim, [Repeat, EndRepeat]);

crates/vim2/src/normal/scroll.rs 🔗

@@ -4,7 +4,7 @@ use editor::{
     scroll::{scroll_amount::ScrollAmount, VERTICAL_SCROLL_MARGIN},
     DisplayPoint, Editor,
 };
-use gpui::{actions, AppContext, ViewContext};
+use gpui::{actions, ViewContext};
 use language::Bias;
 use workspace::Workspace;
 
@@ -13,7 +13,7 @@ actions!(
     [LineUp, LineDown, ScrollUp, ScrollDown, PageUp, PageDown]
 );
 
-pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
+pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
     workspace.register_action(|_: &mut Workspace, _: &LineDown, cx| {
         scroll(cx, false, |c| ScrollAmount::Line(c.unwrap_or(1.)))
     });

crates/vim2/src/normal/search.rs 🔗

@@ -1,7 +1,7 @@
-use gpui::{actions, impl_actions, Action, AppContext, ViewContext};
+use gpui::{actions, impl_actions, ViewContext};
 use search::{buffer_search, BufferSearchBar, SearchMode, SearchOptions};
 use serde_derive::Deserialize;
-use workspace::{searchable::Direction, Pane, Workspace};
+use workspace::{searchable::Direction, Workspace};
 
 use crate::{motion::Motion, normal::move_cursor, state::SearchState, Vim};
 
@@ -50,7 +50,7 @@ impl_actions!(
     [FindCommand, ReplaceCommand, Search, MoveToPrev, MoveToNext]
 );
 
-pub(crate) fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
+pub(crate) fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
     workspace.register_action(move_to_next);
     workspace.register_action(move_to_prev);
     workspace.register_action(search);

crates/vim2/src/object.rs 🔗

@@ -6,7 +6,7 @@ use editor::{
     movement::{self, FindRange},
     Bias, CharKind, DisplayPoint,
 };
-use gpui::{actions, impl_actions, Action, AppContext, ViewContext, WindowContext};
+use gpui::{actions, impl_actions, ViewContext, WindowContext};
 use language::Selection;
 use serde::Deserialize;
 use workspace::Workspace;
@@ -51,7 +51,7 @@ actions!(
     ]
 );
 
-pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
+pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
     workspace.register_action(
         |_: &mut Workspace, &Word { ignore_punctuation }: &Word, cx: _| {
             object(Object::Word { ignore_punctuation }, cx)

crates/vim2/src/vim.rs 🔗

@@ -18,7 +18,7 @@ use command_palette::CommandPaletteInterceptor;
 use editor::{movement, Editor, EditorEvent, EditorMode};
 use gpui::{
     actions, impl_actions, Action, AppContext, EntityId, KeyContext, Subscription, View,
-    ViewContext, WeakModel, WeakView, WindowContext,
+    ViewContext, WeakView, WindowContext,
 };
 use language::{CursorShape, Point, Selection, SelectionGoal};
 pub use mode_indicator::ModeIndicator;
@@ -116,7 +116,7 @@ fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
     visual::register(workspace, cx);
 }
 
-pub fn observe_keystrokes(cx: &mut WindowContext) {
+pub fn observe_keystrokes(_: &mut WindowContext) {
     // todo!()
 
     // cx.observe_keystrokes(|_keystroke, result, handled_by, cx| {

crates/vim2/src/visual.rs 🔗

@@ -8,7 +8,7 @@ use editor::{
     scroll::autoscroll::Autoscroll,
     Bias, DisplayPoint, Editor,
 };
-use gpui::{actions, AppContext, ViewContext, WindowContext};
+use gpui::{actions, ViewContext, WindowContext};
 use language::{Selection, SelectionGoal};
 use workspace::Workspace;
 
@@ -34,7 +34,7 @@ actions!(
     ]
 );
 
-pub fn register(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
+pub fn register(workspace: &mut Workspace, _: &mut ViewContext<Workspace>) {
     workspace.register_action(|_, _: &ToggleVisual, cx: &mut ViewContext<Workspace>| {
         toggle_mode(Mode::Visual, cx)
     });