From cbcacb1063c9b6384867a6078a75595ae2ff6861 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Mon, 22 Mar 2021 12:40:07 +0900 Subject: Merge some imports. --- helix-core/src/lib.rs | 3 +-- helix-core/src/syntax.rs | 25 ++++++++++++++----------- helix-core/src/transaction.rs | 3 +-- helix-lsp/src/select_all.rs | 14 +++++++------- helix-term/src/application.rs | 6 ++---- helix-term/src/commands.rs | 6 ++++-- helix-term/src/compositor.rs | 3 +-- helix-term/src/ui/editor.rs | 10 ++++++---- helix-term/src/ui/markdown.rs | 2 +- helix-term/src/ui/menu.rs | 2 +- helix-term/src/ui/picker.rs | 2 +- helix-term/src/ui/popup.rs | 8 +++++--- helix-term/src/ui/prompt.rs | 3 +-- helix-term/src/ui/text.rs | 2 +- helix-view/src/editor.rs | 4 +--- 15 files changed, 47 insertions(+), 46 deletions(-) diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs index 6b991881..a8a449ca 100644 --- a/helix-core/src/lib.rs +++ b/helix-core/src/lib.rs @@ -51,8 +51,7 @@ pub use tendril::StrTendril as Tendril; pub use {regex, tree_sitter}; pub use position::{coords_at_pos, pos_at_coords, Position}; -pub use selection::Range; -pub use selection::Selection; +pub use selection::{Range, Selection}; pub use syntax::Syntax; pub use diagnostic::Diagnostic; diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index e75dc724..c352f8f2 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -1,12 +1,13 @@ use crate::{Change, Rope, RopeSlice, Transaction}; -pub use helix_syntax::Lang; -pub use helix_syntax::{get_language, get_language_name}; - -use std::borrow::Cow; -use std::cell::RefCell; -use std::collections::HashMap; -use std::path::{Path, PathBuf}; -use std::sync::Arc; +pub use helix_syntax::{get_language, get_language_name, Lang}; + +use std::{ + borrow::Cow, + cell::RefCell, + collections::HashMap, + path::{Path, PathBuf}, + sync::Arc, +}; use once_cell::sync::{Lazy, OnceCell}; @@ -355,9 +356,11 @@ pub struct LanguageLayer { pub(crate) tree: Option, } -use crate::coords_at_pos; -use crate::transaction::{ChangeSet, Operation}; -use crate::Tendril; +use crate::{ + coords_at_pos, + transaction::{ChangeSet, Operation}, + Tendril, +}; impl LanguageLayer { // pub fn new() -> Self { diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs index f25ee208..d707016b 100644 --- a/helix-core/src/transaction.rs +++ b/helix-core/src/transaction.rs @@ -1,6 +1,5 @@ use crate::{Range, Rope, Selection, State, Tendril}; -use std::borrow::Cow; -use std::convert::TryFrom; +use std::{borrow::Cow, convert::TryFrom}; /// (from, to, replacement) pub type Change = (usize, usize, Option); diff --git a/helix-lsp/src/select_all.rs b/helix-lsp/src/select_all.rs index b0623203..4a7f0cbf 100644 --- a/helix-lsp/src/select_all.rs +++ b/helix-lsp/src/select_all.rs @@ -1,15 +1,15 @@ //! An unbounded set of streams -use core::fmt::{self, Debug}; -use core::iter::FromIterator; -use core::pin::Pin; +use core::{ + fmt::{self, Debug}, + iter::FromIterator, + pin::Pin, +}; -use smol::ready; -use smol::stream::Stream; +use smol::{ready, stream::Stream}; use std::task::{Context, Poll}; -use futures_util::stream::FusedStream; -use futures_util::stream::{FuturesUnordered, StreamExt, StreamFuture}; +use futures_util::stream::{FusedStream, FuturesUnordered, StreamExt, StreamFuture}; /// An unbounded set of streams /// diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 16a0f6f6..cab7ad63 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -2,8 +2,7 @@ use clap::ArgMatches as Args; use helix_view::{document::Mode, Document, Editor, Theme, View}; -use crate::compositor::Compositor; -use crate::ui; +use crate::{compositor::Compositor, ui}; use log::{error, info}; @@ -139,9 +138,8 @@ impl Application { .diagnostics .into_iter() .map(|diagnostic| { - use helix_core::diagnostic::Severity::*; use helix_core::{ - diagnostic::{Range, Severity}, + diagnostic::{Range, Severity, Severity::*}, Diagnostic, }; use helix_lsp::{lsp, util::lsp_pos_to_pos}; diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index f7e137e0..3e60277c 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -10,8 +10,10 @@ use helix_core::{ use once_cell::sync::Lazy; -use crate::compositor::Compositor; -use crate::ui::{self, Popup, Prompt, PromptEvent}; +use crate::{ + compositor::Compositor, + ui::{self, Popup, Prompt, PromptEvent}, +}; use std::path::PathBuf; diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs index d7ca6f26..023f9b49 100644 --- a/helix-term/src/compositor.rs +++ b/helix-term/src/compositor.rs @@ -5,8 +5,7 @@ use crossterm::event::Event; use helix_core::Position; use smol::Executor; -use tui::buffer::Buffer as Surface; -use tui::layout::Rect; +use tui::{buffer::Buffer as Surface, layout::Rect}; pub type Callback = Box; diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 670de6d6..3ee9d446 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -1,7 +1,9 @@ -use crate::commands; -use crate::compositor::{Component, Compositor, Context, EventResult}; -use crate::keymap::{self, Keymaps}; -use crate::ui::text_color; +use crate::{ + commands, + compositor::{Component, Compositor, Context, EventResult}, + keymap::{self, Keymaps}, + ui::text_color, +}; use helix_core::{ indent::TAB_WIDTH, diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs index 5e184ba3..e41f9765 100644 --- a/helix-term/src/ui/markdown.rs +++ b/helix-term/src/ui/markdown.rs @@ -1,7 +1,7 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use tui::buffer::Buffer as Surface; use tui::{ + buffer::Buffer as Surface, layout::Rect, style::{Color, Style}, text::Text, diff --git a/helix-term/src/ui/menu.rs b/helix-term/src/ui/menu.rs index 0fdf085f..e9893588 100644 --- a/helix-term/src/ui/menu.rs +++ b/helix-term/src/ui/menu.rs @@ -1,7 +1,7 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use tui::buffer::Buffer as Surface; use tui::{ + buffer::Buffer as Surface, layout::Rect, style::{Color, Style}, widgets::{Block, Borders}, diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index d8da052a..853164c5 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -1,7 +1,7 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use tui::buffer::Buffer as Surface; use tui::{ + buffer::Buffer as Surface, layout::Rect, style::{Color, Style}, widgets::{Block, Borders}, diff --git a/helix-term/src/ui/popup.rs b/helix-term/src/ui/popup.rs index 572c651b..98ccae61 100644 --- a/helix-term/src/ui/popup.rs +++ b/helix-term/src/ui/popup.rs @@ -1,7 +1,7 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use tui::buffer::Buffer as Surface; use tui::{ + buffer::Buffer as Surface, layout::Rect, style::{Color, Style}, widgets::{Block, Borders}, @@ -107,8 +107,10 @@ impl Component for Popup { } fn render(&self, viewport: Rect, surface: &mut Surface, cx: &mut Context) { - use tui::text::Text; - use tui::widgets::{Paragraph, Widget, Wrap}; + use tui::{ + text::Text, + widgets::{Paragraph, Widget, Wrap}, + }; cx.scroll = Some(self.scroll); diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 35890b4c..db691f50 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -1,8 +1,7 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; use helix_core::Position; -use helix_view::Editor; -use helix_view::Theme; +use helix_view::{Editor, Theme}; use std::{borrow::Cow, ops::RangeFrom}; pub struct Prompt { diff --git a/helix-term/src/ui/text.rs b/helix-term/src/ui/text.rs index 9db4d3bc..588e12c4 100644 --- a/helix-term/src/ui/text.rs +++ b/helix-term/src/ui/text.rs @@ -1,7 +1,7 @@ use crate::compositor::{Component, Compositor, Context, EventResult}; use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers}; -use tui::buffer::Buffer as Surface; use tui::{ + buffer::Buffer as Surface, layout::Rect, style::{Color, Style}, }; diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 3de2bfb8..d294d190 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1,6 +1,4 @@ -use crate::theme::Theme; -use crate::tree::Tree; -use crate::{Document, View}; +use crate::{theme::Theme, tree::Tree, Document, View}; use std::path::PathBuf; -- cgit v1.2.3-70-g09d2