From 1c03458de725a91d9913af2b5bc3cffab075b8aa Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Tue, 19 May 2020 23:11:28 +0200 Subject: [PATCH] merge uses --- asyncgit/src/diff.rs | 5 +++-- asyncgit/src/revlog.rs | 3 +-- asyncgit/src/status.rs | 4 ++-- asyncgit/src/sync/diff.rs | 3 +-- asyncgit/src/sync/hooks.rs | 4 ++-- asyncgit/src/sync/hunks.rs | 3 +-- asyncgit/src/sync/status.rs | 3 +-- src/app.rs | 5 ++--- src/components/changes.rs | 2 +- src/components/commit.rs | 6 +++--- src/components/diff.rs | 3 +-- src/components/help.rs | 5 ++--- src/components/mod.rs | 14 +++++++++----- src/components/msg.rs | 3 +-- src/components/reset.rs | 5 ++--- src/main.rs | 6 +++--- src/tabs/revlog/mod.rs | 2 +- src/tabs/status.rs | 2 +- src/ui/mod.rs | 2 +- src/ui/style.rs | 12 ++++++++---- 20 files changed, 46 insertions(+), 46 deletions(-) diff --git a/asyncgit/src/diff.rs b/asyncgit/src/diff.rs index 8bd0ee7c..ad0d337d 100644 --- a/asyncgit/src/diff.rs +++ b/asyncgit/src/diff.rs @@ -1,5 +1,6 @@ -use crate::error::Result; -use crate::{hash, sync, AsyncNotification, FileDiff, CWD}; +use crate::{ + error::Result, hash, sync, AsyncNotification, FileDiff, CWD, +}; use crossbeam_channel::Sender; use log::trace; use std::{ diff --git a/asyncgit/src/revlog.rs b/asyncgit/src/revlog.rs index f76ba5d6..0f15383c 100644 --- a/asyncgit/src/revlog.rs +++ b/asyncgit/src/revlog.rs @@ -1,5 +1,4 @@ -use crate::error::Result; -use crate::{sync, AsyncNotification, CWD}; +use crate::{error::Result, sync, AsyncNotification, CWD}; use crossbeam_channel::Sender; use git2::Oid; use scopetime::scope_time; diff --git a/asyncgit/src/status.rs b/asyncgit/src/status.rs index 1ce62864..5ba24d86 100644 --- a/asyncgit/src/status.rs +++ b/asyncgit/src/status.rs @@ -1,5 +1,6 @@ use crate::{ - error::Result, hash, sync, AsyncNotification, StatusItem, CWD, + error::Result, hash, sync, sync::status::StatusType, + AsyncNotification, StatusItem, CWD, }; use crossbeam_channel::Sender; use log::trace; @@ -10,7 +11,6 @@ use std::{ Arc, Mutex, }, }; -use sync::status::StatusType; #[derive(Default, Hash, Clone)] pub struct Status { diff --git a/asyncgit/src/sync/diff.rs b/asyncgit/src/sync/diff.rs index 9d9c497c..b2a564e0 100644 --- a/asyncgit/src/sync/diff.rs +++ b/asyncgit/src/sync/diff.rs @@ -1,8 +1,7 @@ //! sync git api for fetching a diff use super::utils; -use crate::error::Result; -use crate::{error::Error, hash}; +use crate::{error::Error, error::Result, hash}; use git2::{ Delta, Diff, DiffDelta, DiffFormat, DiffHunk, DiffOptions, Patch, Repository, diff --git a/asyncgit/src/sync/hooks.rs b/asyncgit/src/sync/hooks.rs index 14c340aa..0f7fe385 100644 --- a/asyncgit/src/sync/hooks.rs +++ b/asyncgit/src/sync/hooks.rs @@ -1,10 +1,10 @@ use crate::error::Result; use scopetime::scope_time; -use std::fs::File; -use std::path::PathBuf; use std::{ + fs::File, io::{Read, Write}, path::Path, + path::PathBuf, process::Command, }; diff --git a/asyncgit/src/sync/hunks.rs b/asyncgit/src/sync/hunks.rs index 3a727b7f..00155b15 100644 --- a/asyncgit/src/sync/hunks.rs +++ b/asyncgit/src/sync/hunks.rs @@ -2,8 +2,7 @@ use super::{ diff::{get_diff_raw, HunkHeader}, utils::repo, }; -use crate::error::Result; -use crate::{error::Error, hash}; +use crate::{error::Error, error::Result, hash}; use git2::{ApplyLocation, ApplyOptions, Diff}; use log::error; use scopetime::scope_time; diff --git a/asyncgit/src/sync/status.rs b/asyncgit/src/sync/status.rs index 41b52fcc..ba3f50b0 100644 --- a/asyncgit/src/sync/status.rs +++ b/asyncgit/src/sync/status.rs @@ -1,7 +1,6 @@ //! sync git api for fetching a status -use crate::error::Result; -use crate::{error::Error, sync::utils}; +use crate::{error::Error, error::Result, sync::utils}; use git2::{Status, StatusOptions, StatusShow}; use scopetime::scope_time; use std::path::Path; diff --git a/src/app.rs b/src/app.rs index 62faff6e..b221dbd2 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,4 +1,3 @@ -use crate::ui::style::Theme; use crate::{ accessors, components::{ @@ -10,6 +9,7 @@ use crate::{ queue::{InternalEvent, NeedsUpdate, Queue}, strings, tabs::{Revlog, Status}, + ui::style::Theme, }; use asyncgit::{sync, AsyncNotification, CWD}; use crossbeam_channel::Sender; @@ -18,8 +18,7 @@ use itertools::Itertools; use log::trace; use std::borrow::Cow; use strings::commands; -use tui::style::Style; -use tui::{ +use tui::{style::Style, backend::Backend, layout::{Alignment, Constraint, Direction, Layout, Rect}, style::Modifier, diff --git a/src/components/changes.rs b/src/components/changes.rs index 8c1c4f87..ee27c07d 100644 --- a/src/components/changes.rs +++ b/src/components/changes.rs @@ -3,12 +3,12 @@ use super::{ statustree::{MoveSelection, StatusTree}, CommandBlocking, DrawableComponent, }; -use crate::ui::style::Theme; use crate::{ components::{CommandInfo, Component}, keys, queue::{InternalEvent, NeedsUpdate, Queue, ResetItem}, strings, ui, + ui::style::Theme, }; use asyncgit::{hash, sync, StatusItem, StatusItemType, CWD}; use crossterm::event::Event; diff --git a/src/components/commit.rs b/src/components/commit.rs index 6292bc90..afb0251c 100644 --- a/src/components/commit.rs +++ b/src/components/commit.rs @@ -2,11 +2,11 @@ use super::{ visibility_blocking, CommandBlocking, CommandInfo, Component, DrawableComponent, }; -use crate::components::dialog_paragraph; -use crate::ui::style::Theme; use crate::{ + components::dialog_paragraph, queue::{InternalEvent, NeedsUpdate, Queue}, strings, ui, + ui::style::Theme, }; use asyncgit::{sync, CWD}; use crossterm::event::{Event, KeyCode}; @@ -14,10 +14,10 @@ use log::error; use std::borrow::Cow; use strings::commands; use sync::HookResult; -use tui::style::Style; use tui::{ backend::Backend, layout::Rect, + style::Style, widgets::{Clear, Text}, Frame, }; diff --git a/src/components/diff.rs b/src/components/diff.rs index 1aa599f7..7d6ba9b5 100644 --- a/src/components/diff.rs +++ b/src/components/diff.rs @@ -1,16 +1,15 @@ use super::{CommandBlocking, DrawableComponent, ScrollType}; -use crate::ui::style::Theme; use crate::{ components::{CommandInfo, Component}, keys, queue::{InternalEvent, Queue}, strings, + ui::style::Theme, }; use asyncgit::{hash, DiffLine, DiffLineType, FileDiff}; use crossterm::event::Event; use std::{borrow::Cow, cmp, convert::TryFrom}; use strings::commands; - use tui::{ backend::Backend, layout::{Alignment, Rect}, diff --git a/src/components/help.rs b/src/components/help.rs index bde7d77d..b90f8d3c 100644 --- a/src/components/help.rs +++ b/src/components/help.rs @@ -2,17 +2,16 @@ use super::{ visibility_blocking, CommandBlocking, CommandInfo, Component, DrawableComponent, }; -use crate::ui::style::Theme; -use crate::{keys, strings, ui, version::Version}; +use crate::{keys, strings, ui, ui::style::Theme, version::Version}; use asyncgit::hash; use crossterm::event::Event; use itertools::Itertools; use std::{borrow::Cow, cmp, convert::TryFrom}; use strings::commands; -use tui::style::{Modifier, Style}; use tui::{ backend::Backend, layout::{Alignment, Constraint, Direction, Layout, Rect}, + style::{Modifier, Style}, widgets::{Block, Borders, Clear, Paragraph, Text}, Frame, }; diff --git a/src/components/mod.rs b/src/components/mod.rs index fd1f3235..5af5e525 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -1,6 +1,3 @@ -use crossterm::event::Event; -use tui::{backend::Backend, layout::Rect, Frame}; - mod changes; mod command; mod commit; @@ -18,8 +15,15 @@ pub use filetree::FileTreeItemKind; pub use help::HelpComponent; pub use msg::MsgComponent; pub use reset::ResetComponent; -use tui::layout::Alignment; -use tui::widgets::{Block, Borders, Paragraph, Text}; + +use crossterm::event::Event; +use tui::{ + backend::Backend, + layout::Alignment, + layout::Rect, + widgets::{Block, Borders, Paragraph, Text}, + Frame, +}; /// creates accessors for a list of components /// diff --git a/src/components/msg.rs b/src/components/msg.rs index bf8daacd..6c1baf7f 100644 --- a/src/components/msg.rs +++ b/src/components/msg.rs @@ -2,8 +2,7 @@ use super::{ visibility_blocking, CommandBlocking, CommandInfo, Component, DrawableComponent, }; -use crate::components::dialog_paragraph; -use crate::{keys, strings, ui}; +use crate::{components::dialog_paragraph, keys, strings, ui}; use crossterm::event::Event; use std::borrow::Cow; use strings::commands; diff --git a/src/components/reset.rs b/src/components/reset.rs index c91dcc01..f4a5f6b0 100644 --- a/src/components/reset.rs +++ b/src/components/reset.rs @@ -3,12 +3,11 @@ use super::{ DrawableComponent, }; use crate::{ + components::dialog_paragraph, queue::{InternalEvent, Queue, ResetItem}, strings, ui, + ui::style::Theme, }; - -use crate::components::dialog_paragraph; -use crate::ui::style::Theme; use crossterm::event::{Event, KeyCode}; use std::borrow::Cow; use strings::commands; diff --git a/src/main.rs b/src/main.rs index 7115ace0..6c79b7df 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,17 +25,17 @@ use crossterm::{ }, ExecutableCommand, Result, }; -use io::Write; use log::error; use scopeguard::defer; use scopetime::scope_time; use simplelog::{Config, LevelFilter, WriteLogger}; use spinner::Spinner; -use std::path::PathBuf; use std::{ env, fs, fs::File, - io, panic, + io::{self, Write}, + panic, + path::PathBuf, time::{Duration, Instant}, }; use tui::{ diff --git a/src/tabs/revlog/mod.rs b/src/tabs/revlog/mod.rs index fc16c435..495224d1 100644 --- a/src/tabs/revlog/mod.rs +++ b/src/tabs/revlog/mod.rs @@ -1,6 +1,5 @@ mod utils; -use crate::ui::style::Theme; use crate::{ components::{ CommandBlocking, CommandInfo, Component, DrawableComponent, @@ -9,6 +8,7 @@ use crate::{ keys, strings::commands, ui::calc_scroll_top, + ui::style::Theme, }; use asyncgit::{sync, AsyncLog, AsyncNotification, CWD}; use crossbeam_channel::Sender; diff --git a/src/tabs/status.rs b/src/tabs/status.rs index 4b371480..d73e46ec 100644 --- a/src/tabs/status.rs +++ b/src/tabs/status.rs @@ -1,4 +1,3 @@ -use crate::ui::style::Theme; use crate::{ accessors, components::{ @@ -9,6 +8,7 @@ use crate::{ keys, queue::Queue, strings, + ui::style::Theme, }; use asyncgit::{ current_tick, AsyncDiff, AsyncNotification, AsyncStatus, diff --git a/src/ui/mod.rs b/src/ui/mod.rs index f829b7a1..957a700e 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -2,10 +2,10 @@ mod scrolllist; pub(crate) mod style; use crate::ui::style::Theme; use scrolllist::ScrollableList; -use tui::style::Modifier; use tui::{ backend::Backend, layout::{Constraint, Direction, Layout, Rect}, + style::Modifier, widgets::{Block, Borders, Text}, Frame, }; diff --git a/src/ui/style.rs b/src/ui/style.rs index 2dd1172a..747d139d 100644 --- a/src/ui/style.rs +++ b/src/ui/style.rs @@ -1,11 +1,15 @@ use crate::get_app_config_path; use asyncgit::{DiffLineType, StatusItemType}; -use ron::de::from_bytes; -use ron::ser::{to_string_pretty, PrettyConfig}; +use ron::{ + de::from_bytes, + ser::{to_string_pretty, PrettyConfig}, +}; use serde::{Deserialize, Serialize}; -use std::fs::File; -use std::io::{Read, Write}; use std::path::PathBuf; +use std::{ + fs::File, + io::{Read, Write}, +}; use tui::style::{Color, Modifier, Style}; #[derive(Serialize, Deserialize, Debug, Clone, Copy)]