Remove small pieces of unused code

Max Brunsfeld created

Change summary

gpui/src/platform/mac/mod.rs     | 1 +
gpui/src/platform/mac/window.rs  | 3 ---
gpui/src/scene.rs                | 4 ----
zed/src/editor/buffer/mod.rs     | 4 ----
zed/src/editor/buffer_element.rs | 2 +-
zed/src/editor/buffer_view.rs    | 1 -
zed/src/operation_queue.rs       | 5 -----
zed/src/util.rs                  | 5 -----
zed/src/workspace/workspace.rs   | 8 +++-----
zed/src/worktree/worktree.rs     | 4 +---
10 files changed, 6 insertions(+), 31 deletions(-)

Detailed changes

gpui/src/platform/mac/mod.rs 🔗

@@ -24,6 +24,7 @@ pub fn app() -> impl platform::App {
 pub fn runner() -> impl platform::Runner {
     Runner::new()
 }
+
 trait BoolExt {
     fn to_objc(self) -> BOOL;
 }

gpui/src/platform/mac/window.rs 🔗

@@ -126,7 +126,6 @@ struct WindowState {
     scene_to_render: Option<Scene>,
     renderer: Renderer,
     command_queue: metal::CommandQueue,
-    device: metal::Device,
     layer: id,
 }
 
@@ -189,7 +188,6 @@ impl Window {
                 scene_to_render: Default::default(),
                 renderer: Renderer::new(device.clone(), PIXEL_FORMAT, fonts)?,
                 command_queue: device.new_command_queue(),
-                device,
                 layer,
             })));
 
@@ -426,7 +424,6 @@ extern "C" fn display_layer(this: &Object, _: Sel, _: id) {
 
             let size = window_state.size();
             let scale_factor = window_state.scale_factor();
-            let device = window_state.device.clone();
 
             window_state.renderer.render(
                 &scene,

gpui/src/scene.rs 🔗

@@ -221,10 +221,6 @@ impl Border {
         self
     }
 
-    fn all_sides(&self) -> bool {
-        self.top && self.left && self.bottom && self.right
-    }
-
     pub fn top_width(&self) -> f32 {
         if self.top {
             self.width

zed/src/editor/buffer/mod.rs 🔗

@@ -1650,10 +1650,6 @@ impl Fragment {
         self.text = self.insertion.text.slice(self.start_offset()..offset);
     }
 
-    fn as_str(&self) -> &str {
-        self.text.as_str()
-    }
-
     fn visible_len(&self) -> usize {
         if self.is_visible() {
             self.len()

zed/src/editor/buffer_element.rs 🔗

@@ -8,7 +8,7 @@ use gpui::{
     },
     text_layout::{self, TextLayoutCache},
     AfterLayoutContext, AppContext, Border, Element, Event, EventContext, FontCache, LayoutContext,
-    MutableAppContext, PaintContext, Quad, Scene, SizeConstraint, ViewHandle,
+    PaintContext, Quad, Scene, SizeConstraint, ViewHandle,
 };
 use smallvec::SmallVec;
 use std::cmp::Ordering;

zed/src/editor/buffer_view.rs 🔗

@@ -4,7 +4,6 @@ use super::{
 };
 use crate::{settings::Settings, watch, workspace};
 use anyhow::Result;
-use easy_parallel::Parallel;
 use gpui::{
     fonts::Properties as FontProperties, keymap::Binding, text_layout, App, AppContext, Element,
     ElementBox, Entity, FontCache, ModelHandle, View, ViewContext, WeakViewHandle,

zed/src/operation_queue.rs 🔗

@@ -28,11 +28,6 @@ impl<T: Operation> OperationQueue<T> {
         OperationQueue(SumTree::new())
     }
 
-    #[cfg(test)]
-    pub fn is_empty(&self) -> bool {
-        self.0.is_empty()
-    }
-
     pub fn len(&self) -> usize {
         self.0.summary().len
     }

zed/src/util.rs 🔗

@@ -1,11 +1,6 @@
 use rand::prelude::*;
 use std::cmp::Ordering;
 
-pub fn pre_inc(value: &mut usize) -> usize {
-    *value += 1;
-    *value
-}
-
 pub fn post_inc(value: &mut usize) -> usize {
     let prev = *value;
     *value += 1;

zed/src/workspace/workspace.rs 🔗

@@ -7,9 +7,7 @@ use crate::{
     worktree::{Worktree, WorktreeHandle as _},
 };
 use anyhow::anyhow;
-use gpui::{
-    App, AppContext, Entity, Handle, ModelContext, ModelHandle, MutableAppContext, ViewContext,
-};
+use gpui::{AppContext, Entity, Handle, ModelContext, ModelHandle, MutableAppContext, ViewContext};
 use smol::prelude::*;
 use std::{
     collections::{HashMap, HashSet},
@@ -202,12 +200,12 @@ impl Entity for Workspace {
 
 #[cfg(test)]
 pub trait WorkspaceHandle {
-    fn file_entries(&self, app: &App) -> Vec<(usize, usize)>;
+    fn file_entries(&self, app: &gpui::App) -> Vec<(usize, usize)>;
 }
 
 #[cfg(test)]
 impl WorkspaceHandle for ModelHandle<Workspace> {
-    fn file_entries(&self, app: &App) -> Vec<(usize, usize)> {
+    fn file_entries(&self, app: &gpui::App) -> Vec<(usize, usize)> {
         self.read(&app, |w, app| {
             w.worktrees()
                 .iter()

zed/src/worktree/worktree.rs 🔗

@@ -60,10 +60,8 @@ impl Worktree {
             tree.0.write().scanning = true;
 
             let tree = tree.clone();
-            let (tx, rx) = smol::channel::bounded(1);
-
             let task = ctx.background_executor().spawn(async move {
-                let _ = tx.send(tree.scan_dirs()?).await;
+                tree.scan_dirs()?;
                 Ok(())
             });