From e474779c8729c36335b76badc98d8211829122d2 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Thu, 9 Feb 2023 03:24:31 +0100 Subject: [PATCH] bump msrv to 1.63 (#5570) * bump msrv to 1.63 * resolve new complex type clippy lints --- .github/workflows/build.yml | 16 ++++------------ .github/workflows/msrv-rust-toolchain.toml | 3 --- 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 +++++++---- rust-toolchain.toml | 2 +- 10 files changed, 32 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/msrv-rust-toolchain.toml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f3b778ad..44d267884 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,19 +10,11 @@ on: jobs: check: - name: Check + name: Check (msrv) runs-on: ubuntu-latest - strategy: - matrix: - rust: [stable, msrv] steps: - name: Checkout sources uses: actions/checkout@v3 - - - name: Use MSRV rust toolchain - if: matrix.rust == 'msrv' - run: cp .github/workflows/msrv-rust-toolchain.toml rust-toolchain.toml - - name: Install stable toolchain uses: helix-editor/rust-toolchain@v1 with: @@ -45,7 +37,7 @@ jobs: uses: actions/checkout@v3 - name: Install stable toolchain - uses: dtolnay/rust-toolchain@1.61 + uses: dtolnay/rust-toolchain@1.63 - uses: Swatinem/rust-cache@v2 @@ -74,7 +66,7 @@ jobs: uses: actions/checkout@v3 - name: Install stable toolchain - uses: dtolnay/rust-toolchain@1.61 + uses: dtolnay/rust-toolchain@1.63 with: components: rustfmt, clippy @@ -99,7 +91,7 @@ jobs: uses: actions/checkout@v3 - name: Install stable toolchain - uses: dtolnay/rust-toolchain@1.61 + uses: dtolnay/rust-toolchain@1.63 - uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/msrv-rust-toolchain.toml b/.github/workflows/msrv-rust-toolchain.toml deleted file mode 100644 index b169d31e6..000000000 --- a/.github/workflows/msrv-rust-toolchain.toml +++ /dev/null @@ -1,3 +0,0 @@ -[toolchain] -channel = "1.61.0" -components = ["rustfmt", "rust-src"] diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 157d19f73..e6cbed2ce 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -73,13 +73,15 @@ 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 2e4a2e20e..bcb3e4490 100644 --- a/helix-term/src/compositor.rs +++ b/helix-term/src/compositor.rs @@ -7,6 +7,7 @@ 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 2888b6eb1..19f2521a5 100644 --- a/helix-term/src/job.rs +++ b/helix-term/src/job.rs @@ -5,9 +5,12 @@ 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 f297b44eb..493f8d501 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 @@ 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 3ae007039..8aa10c08b 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -43,6 +43,8 @@ fn format(&self, root_path: &Self::Data) -> Row { } } +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 5190fc531..803e2d65b 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -70,6 +70,8 @@ fn from(v: DocumentId) -> Self { } } +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 @@ fn cmp(&self, other: &Self) -> Ordering { } } +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 5fb6745a9..f438231fa 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -14,8 +14,11 @@ 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, } diff --git a/rust-toolchain.toml b/rust-toolchain.toml index b169d31e6..ace4f5f96 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.61.0" +channel = "1.63.0" components = ["rustfmt", "rust-src"]