Remove small pieces of unused code

This commit is contained in:
Max Brunsfeld 2021-04-02 14:26:53 -07:00
parent ce6ca13b13
commit dd31b870c3
10 changed files with 6 additions and 31 deletions

View File

@ -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;
}

View File

@ -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,

View File

@ -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

View File

@ -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()

View File

@ -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;

View File

@ -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,

View File

@ -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
}

View File

@ -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;

View File

@ -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()

View File

@ -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(())
});