Remove most of the dead code

This commit is contained in:
Dániel Buga 2022-05-12 21:05:13 +02:00
parent 066135b824
commit 02cc1478fe
10 changed files with 4 additions and 114 deletions

View File

@ -15,12 +15,6 @@ pub struct RegisterData {
pub struct Register {
pub unamed: RegisterData,
last_yank: RegisterData,
#[allow(dead_code)]
last_deletes: [RegisterData; 10],
#[allow(dead_code)]
newest_delete: usize,
}
pub enum RegisterKind {

View File

@ -381,7 +381,6 @@ pub fn receive(
item: i.to_owned(),
score: 0,
label_score: 0,
index: 0,
indices: Vec::new(),
})
.collect();
@ -459,9 +458,6 @@ fn default() -> Self {
pub struct ScoredCompletionItem {
pub item: CompletionItem,
#[allow(dead_code)]
pub index: usize,
pub score: i64,
pub label_score: i64,
pub indices: Vec<usize>,

View File

@ -6,7 +6,6 @@
use druid::ExtEventSink;
use druid::{Target, WidgetId};
use include_dir::{include_dir, Dir};
use lapce_rpc::file::FileNodeItem;
use lapce_rpc::proxy::ReadDirResponse;
@ -15,18 +14,12 @@
use crate::{command::LapceUICommand, command::LAPCE_UI_COMMAND};
#[allow(dead_code)]
const ICONS_DIR: Dir = include_dir!("../icons");
#[derive(Clone)]
pub struct FileExplorerData {
pub tab_id: WidgetId,
pub widget_id: WidgetId,
pub workspace: Option<FileNodeItem>,
pub active_selected: Option<PathBuf>,
#[allow(dead_code)]
count: usize,
}
impl FileExplorerData {
@ -64,7 +57,6 @@ pub fn new(
children_open_count: 0,
}),
active_selected: None,
count: 0,
}
}

View File

@ -13,7 +13,6 @@
pub mod hover;
pub mod keypress;
pub mod menu;
pub mod outline;
pub mod palette;
pub mod panel;
pub mod picker;

View File

@ -1,20 +0,0 @@
use druid::WidgetId;
pub struct OutlineState {
#[allow(dead_code)]
widget_id: WidgetId,
}
impl OutlineState {
pub fn new() -> Self {
Self {
widget_id: WidgetId::next(),
}
}
}
impl Default for OutlineState {
fn default() -> Self {
Self::new()
}
}

View File

@ -6,7 +6,6 @@
};
use alacritty_terminal::{
ansi,
config::Program,
event::OnResize,
event_loop::Msg,
@ -277,9 +276,6 @@ fn finished(&self) -> bool {
pub struct State {
write_list: VecDeque<Cow<'static, [u8]>>,
writing: Option<Writing>,
#[allow(dead_code)]
parser: ansi::Processor,
}
impl State {
@ -311,7 +307,7 @@ fn set_current(&mut self, new: Option<Writing>) {
}
}
#[allow(dead_code)]
#[cfg(target_os = "macos")]
fn set_locale_environment() {
let locale = locale_config::Locale::global_default()
.to_string()

View File

@ -643,7 +643,6 @@ pub fn update(&mut self, input: String, completion_items: Vec<CompletionItem>) {
item: item.to_owned(),
score: -1 - index as i64,
label_score: -1 - index as i64,
index,
indices: Vec::new(),
})
.collect();

View File

@ -8,7 +8,7 @@
piet::{Text, TextLayoutBuilder},
BoxConstraints, Command, Data, Env, Event, EventCtx, FontFamily, LayoutCtx,
LifeCycle, LifeCycleCtx, PaintCtx, Point, RenderContext, Size, Target,
UpdateCtx, Widget, WidgetExt, WidgetId, WidgetPod, WindowId,
UpdateCtx, Widget, WidgetExt, WidgetId, WidgetPod,
};
use druid::{FontWeight, Modifiers};
use lapce_data::command::LAPCE_COMMAND;
@ -22,7 +22,6 @@
keypress::KeyPressFocus,
palette::{PaletteStatus, PaletteType, PaletteViewData, PaletteViewLens},
};
use lsp_types::SymbolKind;
use crate::{
editor::view::LapceEditorView,
@ -30,13 +29,6 @@
svg::{file_svg_new, symbol_svg_new},
};
#[derive(Clone, Debug, PartialEq)]
pub enum PaletteIcon {
File(String),
Symbol(SymbolKind),
None,
}
pub struct NewPalette {
widget_id: WidgetId,
container: WidgetPod<LapceTabData, Box<dyn Widget<LapceTabData>>>,
@ -426,25 +418,6 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) {
}
}
pub struct PaletteInput {
#[allow(dead_code)]
window_id: WindowId,
#[allow(dead_code)]
tab_id: WidgetId,
}
pub struct PaletteContent {
#[allow(dead_code)]
window_id: WindowId,
#[allow(dead_code)]
tab_id: WidgetId,
#[allow(dead_code)]
max_items: usize,
}
pub struct NewPaletteInput {}
impl NewPaletteInput {
@ -937,23 +910,3 @@ fn layout(
fn paint(&mut self, _ctx: &mut PaintCtx, _data: &PaletteViewData, _env: &Env) {}
}
impl PaletteInput {
pub fn new(window_id: WindowId, tab_id: WidgetId) -> PaletteInput {
PaletteInput { window_id, tab_id }
}
}
impl PaletteContent {
pub fn new(
window_id: WindowId,
tab_id: WidgetId,
max_items: usize,
) -> PaletteContent {
PaletteContent {
window_id,
tab_id,
max_items,
}
}
}

View File

@ -20,8 +20,6 @@
};
pub struct LapcePanel {
#[allow(dead_code)]
widget_id: WidgetId,
header: WidgetPod<LapceTabData, Box<dyn Widget<LapceTabData>>>,
split: WidgetPod<LapceTabData, LapceSplitNew>,
}
@ -132,7 +130,6 @@ pub fn new(
PanelHeaderKind::Widget(w) => w,
};
Self {
widget_id,
split: WidgetPod::new(split),
header: WidgetPod::new(header),
}
@ -174,8 +171,6 @@ pub enum PanelHeaderKind {
}
pub struct PanelSection {
#[allow(dead_code)]
widget_id: WidgetId,
header: Option<WidgetPod<LapceTabData, Box<dyn Widget<LapceTabData>>>>,
content: WidgetPod<
LapceTabData,
@ -185,13 +180,12 @@ pub struct PanelSection {
impl PanelSection {
pub fn new(
widget_id: WidgetId,
_widget_id: WidgetId,
header: Option<Box<dyn Widget<LapceTabData>>>,
content: Box<dyn Widget<LapceTabData>>,
) -> Self {
let content = LapceScrollNew::new(content).vertical();
Self {
widget_id,
header: header.map(WidgetPod::new),
content: WidgetPod::new(content),
}
@ -380,20 +374,17 @@ pub struct PanelMainHeader {
text: ReadOnlyString,
icons: Vec<LapceIcon>,
#[allow(dead_code)]
panel_widget_id: WidgetId,
kind: PanelKind,
mouse_pos: Point,
}
impl PanelMainHeader {
pub fn new(
panel_widget_id: WidgetId,
_panel_widget_id: WidgetId,
kind: PanelKind,
text: ReadOnlyString,
) -> Self {
Self {
panel_widget_id,
kind,
text,
icons: Vec::new(),

View File

@ -81,16 +81,6 @@ pub fn force_pan_to(&mut self, origin: Point) -> bool {
}
}
#[derive(Debug, Clone)]
enum ScrollDirection {
#[allow(dead_code)]
Bidirectional,
#[allow(dead_code)]
Vertical,
#[allow(dead_code)]
Horizontal,
}
/// Minimum length for any scrollbar to be when measured on that
/// scrollbar's primary axis.
pub const SCROLLBAR_MIN_SIZE: f64 = 45.0;