From e474779c8729c36335b76badc98d8211829122d2 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Thu, 9 Feb 2023 03:24:31 +0100 Subject: bump msrv to 1.63 (#5570) * bump msrv to 1.63 * resolve new complex type clippy lints--- helix-term/src/commands.rs | 4 +++- helix-term/src/compositor.rs | 1 + helix-term/src/job.rs | 7 +++++-- helix-term/src/ui/editor.rs | 4 ++-- helix-term/src/ui/menu.rs | 4 +++- helix-term/src/ui/picker.rs | 8 ++++++-- helix-term/src/ui/prompt.rs | 11 +++++++---- 7 files changed, 27 insertions(+), 12 deletions(-) (limited to 'helix-term/src') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 157d19f7..e6cbed2c 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -73,13 +73,15 @@ use grep_searcher::{sinks, BinaryDetection, SearcherBuilder}; use ignore::{DirEntry, WalkBuilder, WalkState}; use tokio_stream::wrappers::UnboundedReceiverStream; +pub type OnKeyCallback = Box; + pub struct Context<'a> { pub register: Option, pub count: Option, pub editor: &'a mut Editor, pub callback: Option, - pub on_next_key_callback: Option>, + pub on_next_key_callback: Option, pub jobs: &'a mut Jobs, } diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs index 2e4a2e20..bcb3e449 100644 --- a/helix-term/src/compositor.rs +++ b/helix-term/src/compositor.rs @@ -7,6 +7,7 @@ use helix_view::graphics::{CursorKind, Rect}; use tui::buffer::Buffer as Surface; pub type Callback = Box; +pub type SyncCallback = Box; // Cursive-inspired pub enum EventResult { diff --git a/helix-term/src/job.rs b/helix-term/src/job.rs index 2888b6eb..19f2521a 100644 --- a/helix-term/src/job.rs +++ b/helix-term/src/job.rs @@ -5,9 +5,12 @@ use crate::compositor::Compositor; use futures_util::future::{BoxFuture, Future, FutureExt}; use futures_util::stream::{FuturesUnordered, StreamExt}; +pub type EditorCompositorCallback = Box; +pub type EditorCallback = Box; + pub enum Callback { - EditorCompositor(Box), - Editor(Box), + EditorCompositor(EditorCompositorCallback), + Editor(EditorCallback), } pub type JobFuture = BoxFuture<'static, anyhow::Result>>; diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index f297b44e..493f8d50 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -1,5 +1,5 @@ use crate::{ - commands, + commands::{self, OnKeyCallback}, compositor::{Component, Context, Event, EventResult}, job::{self, Callback}, key, @@ -37,7 +37,7 @@ use super::{document::LineDecoration, lsp::SignatureHelp}; pub struct EditorView { pub keymaps: Keymaps, - on_next_key: Option>, + on_next_key: Option, pseudo_pending: Vec, last_insert: (commands::MappableCommand, Vec), pub(crate) completion: Option, diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index 3ae00703..8aa10c08 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -43,6 +43,8 @@ impl Item for PathBuf { } } +pub type MenuCallback = Box, MenuEvent)>; + pub struct Menu { options: Vec, editor_data: T::Data, @@ -55,7 +57,7 @@ pub struct Menu { widths: Vec, - callback_fn: Box, MenuEvent)>, + callback_fn: MenuCallback, scroll: usize, size: (u16, u16), diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 5190fc53..803e2d65 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -70,6 +70,8 @@ impl From for PathOrId { } } +type FileCallback = Box Option>; + /// File path and range of lines (used to align and highlight lines) pub type FileLocation = (PathOrId, Option<(usize, usize)>); @@ -80,7 +82,7 @@ pub struct FilePicker { preview_cache: HashMap, read_buffer: Vec, /// Given an item in the picker, return the file path and line number to display. - file_fn: Box Option>, + file_fn: FileCallback, } pub enum CachedPreview { @@ -394,6 +396,8 @@ impl Ord for PickerMatch { } } +type PickerCallback = Box; + pub struct Picker { options: Vec, editor_data: T::Data, @@ -415,7 +419,7 @@ pub struct Picker { /// Constraints for tabular formatting widths: Vec, - callback_fn: Box, + callback_fn: PickerCallback, } impl Picker { diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 5fb6745a..f438231f 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -14,8 +14,11 @@ use helix_view::{ Editor, }; -pub type Completion = (RangeFrom, Cow<'static, str>); type PromptCharHandler = Box; +pub type Completion = (RangeFrom, Cow<'static, str>); +type CompletionFn = Box Vec>; +type CallbackFn = Box; +pub type DocFn = Box Option>>; pub struct Prompt { prompt: Cow<'static, str>, @@ -25,9 +28,9 @@ pub struct Prompt { selection: Option, history_register: Option, history_pos: Option, - completion_fn: Box Vec>, - callback_fn: Box, - pub doc_fn: Box Option>>, + completion_fn: CompletionFn, + callback_fn: CallbackFn, + pub doc_fn: DocFn, next_char_handler: Option, } -- cgit v1.2.3-70-g09d2