summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Oram <dev@mitmaro.ca>2024-02-11 15:18:22 -0330
committerTim Oram <dev@mitmaro.ca>2024-02-15 20:27:06 -0330
commitb345500c9d76b862edad4ae040bcb3061bd5e47b (patch)
tree3d116f59417e03a66f84f3de142b35c622ad5bf1
parent6677baec763f47e7a500ba29d04ead33d8d008f8 (diff)
Cleanup use declarations
-rw-r--r--Makefile.toml2
-rw-r--r--src/application.rs3
-rw-r--r--src/components/confirm.rs4
-rw-r--r--src/components/search_bar/tests.rs1
-rw-r--r--src/components/shared.rs2
-rw-r--r--src/config.rs4
-rw-r--r--src/config/color.rs2
-rw-r--r--src/config/errors.rs2
-rw-r--r--src/config/errors/config_error_cause.rs2
-rw-r--r--src/config/git_config.rs5
-rw-r--r--src/config/key_bindings.rs2
-rw-r--r--src/config/theme.rs4
-rw-r--r--src/display/crossterm.rs2
-rw-r--r--src/display/tui.rs2
-rw-r--r--src/display/utils.rs2
-rw-r--r--src/git.rs5
-rw-r--r--src/git/commit.rs2
-rw-r--r--src/git/commit_diff.rs14
-rw-r--r--src/git/commit_diff_loader.rs18
-rw-r--r--src/git/delta.rs2
-rw-r--r--src/git/file_status.rs2
-rw-r--r--src/git/reference.rs2
-rw-r--r--src/git/repository.rs5
-rw-r--r--src/input.rs2
-rw-r--r--src/input/event_handler.rs2
-rw-r--r--src/input/testutil.rs2
-rw-r--r--src/input/thread.rs4
-rw-r--r--src/modules/list/tests/toggle_break.rs2
-rw-r--r--src/process.rs4
-rw-r--r--src/process/results.rs2
-rw-r--r--src/runtime.rs2
-rw-r--r--src/runtime/notifier.rs2
-rw-r--r--src/runtime/threadable.rs2
-rw-r--r--src/search.rs1
-rw-r--r--src/search/action.rs2
-rw-r--r--src/search/state.rs2
-rw-r--r--src/search/thread.rs9
-rw-r--r--src/testutil/action_line.rs2
-rw-r--r--src/todo_file.rs6
-rw-r--r--src/todo_file/action.rs2
-rw-r--r--src/todo_file/edit_content.rs2
-rw-r--r--src/todo_file/errors/io.rs2
-rw-r--r--src/todo_file/history.rs2
-rw-r--r--src/todo_file/history/history_item.rs2
-rw-r--r--src/todo_file/line.rs2
-rw-r--r--src/todo_file/line_parser.rs2
-rw-r--r--src/todo_file/utils.rs2
-rw-r--r--src/view.rs3
-rw-r--r--src/view/render_slice.rs5
-rw-r--r--src/view/render_slice/tests.rs8
-rw-r--r--src/view/testutil.rs37
-rw-r--r--src/view/testutil/assert_rendered_output.rs2
-rw-r--r--src/view/view_line.rs2
53 files changed, 98 insertions, 110 deletions
diff --git a/Makefile.toml b/Makefile.toml
index 341a437..828920d 100644
--- a/Makefile.toml
+++ b/Makefile.toml
@@ -1,5 +1,5 @@
[env]
-RUST_NIGHTLY_VERSION_PREFIX = ""
+RUST_NIGHTLY_VERSION_PREFIX = "-2024-02-10"
[config]
skip_core_tasks = true
diff --git a/src/application.rs b/src/application.rs
index 119d220..a640b51 100644
--- a/src/application.rs
+++ b/src/application.rs
@@ -15,7 +15,6 @@ use crate::{
process::{self, Process},
runtime::{Runtime, ThreadStatuses, Threadable},
search,
- search::UpdateHandlerFn,
todo_file::{TodoFile, TodoFileOptions},
view::View,
Args,
@@ -192,7 +191,7 @@ where ModuleProvider: module::ModuleProvider + Send + 'static
mod tests {
use std::ffi::OsString;
- use claims::{assert_none, assert_ok};
+ use claims::assert_ok;
use super::*;
use crate::{
diff --git a/src/components/confirm.rs b/src/components/confirm.rs
index f512352..7401cd9 100644
--- a/src/components/confirm.rs
+++ b/src/components/confirm.rs
@@ -3,12 +3,12 @@ mod confirmed;
mod tests;
use captur::capture;
-pub(crate) use confirmed::Confirmed;
use lazy_static::lazy_static;
+pub(crate) use self::confirmed::Confirmed;
use crate::{
events::{Event, KeyBindings, MetaEvent},
- input::{InputOptions, KeyCode, KeyEvent, KeyModifiers},
+ input::{InputOptions, KeyCode, KeyEvent},
view::{ViewData, ViewLine},
};
diff --git a/src/components/search_bar/tests.rs b/src/components/search_bar/tests.rs
index 411b68e..382163d 100644
--- a/src/components/search_bar/tests.rs
+++ b/src/components/search_bar/tests.rs
@@ -2,6 +2,7 @@ use claims::{assert_none, assert_some_eq};
use super::*;
use crate::{assert_rendered_output, view::ViewData};
+
fn create_view_data(search_bar: &SearchBar) -> ViewData {
let view_line = search_bar.build_view_line();
ViewData::new(|updater| updater.push_line(view_line))
diff --git a/src/components/shared.rs b/src/components/shared.rs
index 0a3a43a..b5f0bdc 100644
--- a/src/components/shared.rs
+++ b/src/components/shared.rs
@@ -1,3 +1,3 @@
mod editable_line;
-pub(crate) use editable_line::{EditAction, EditableLine};
+pub(crate) use self::editable_line::{EditAction, EditableLine};
diff --git a/src/config.rs b/src/config.rs
index de8c988..477915d 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -10,7 +10,7 @@
mod color;
mod diff_ignore_whitespace_setting;
mod diff_show_whitespace_setting;
-pub(crate) mod errors;
+mod errors;
mod git_config;
mod key_bindings;
mod theme;
@@ -30,7 +30,7 @@ pub(crate) use self::{
};
use crate::{
config::{
- errors::{ConfigError, ConfigErrorCause},
+ errors::{ConfigError, ConfigErrorCause, InvalidColorError},
utils::get_optional_string,
},
git::Repository,
diff --git a/src/config/color.rs b/src/config/color.rs
index fe682d6..546f631 100644
--- a/src/config/color.rs
+++ b/src/config/color.rs
@@ -1,4 +1,4 @@
-use crate::config::errors::InvalidColorError;
+use crate::config::InvalidColorError;
/// Represents a color.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
diff --git a/src/config/errors.rs b/src/config/errors.rs
index a3aedb6..a19b2b9 100644
--- a/src/config/errors.rs
+++ b/src/config/errors.rs
@@ -10,7 +10,7 @@ use std::fmt::{Display, Formatter};
use thiserror::Error;
-pub(crate) use crate::config::errors::{config_error_cause::ConfigErrorCause, invalid_color::InvalidColorError};
+pub(crate) use self::{config_error_cause::ConfigErrorCause, invalid_color::InvalidColorError};
/// Config errors
#[derive(Error, Debug, PartialEq)]
diff --git a/src/config/errors/config_error_cause.rs b/src/config/errors/config_error_cause.rs
index 8bbdec1..2a68d0b 100644
--- a/src/config/errors/config_error_cause.rs
+++ b/src/config/errors/config_error_cause.rs
@@ -1,6 +1,6 @@
use thiserror::Error;
-use crate::{config::errors::InvalidColorError, git::errors::GitError};
+use crate::{config::InvalidColorError, git::GitError};
/// The kind of config error that occurred.
#[derive(Error, Debug, PartialEq)]
diff --git a/src/config/git_config.rs b/src/config/git_config.rs
index a928b71..7307edd 100644
--- a/src/config/git_config.rs
+++ b/src/config/git_config.rs
@@ -2,9 +2,8 @@ use std::env;
use crate::{
config::{
- errors::ConfigError,
- get_string,
- utils::{get_unsigned_integer, git_diff_renames},
+ utils::{get_string, get_unsigned_integer, git_diff_renames},
+ ConfigError,
},
git::Config,
};
diff --git a/src/config/key_bindings.rs b/src/config/key_bindings.rs
index f60b580..62a2003 100644
--- a/src/config/key_bindings.rs
+++ b/src/config/key_bindings.rs
@@ -1,5 +1,5 @@
use crate::{
- config::{errors::ConfigError, utils::get_input},
+ config::{utils::get_input, ConfigError},
git::Config,
};
diff --git a/src/config/theme.rs b/src/config/theme.rs
index ec6ccd4..7ae8d06 100644
--- a/src/config/theme.rs
+++ b/src/config/theme.rs
@@ -1,8 +1,8 @@
use crate::{
config::{
- errors::ConfigError,
utils::{get_optional_string, get_string},
Color,
+ ConfigError,
ConfigErrorCause,
},
git::Config,
@@ -146,9 +146,9 @@ mod tests {
use super::*;
use crate::config::{
- errors::InvalidColorError,
testutils::{invalid_utf, with_git_config},
ConfigErrorCause,
+ InvalidColorError,
};
macro_rules! config_test {
diff --git a/src/display/crossterm.rs b/src/display/crossterm.rs
index da2da8e..e10d8de 100644
--- a/src/display/crossterm.rs
+++ b/src/display/crossterm.rs
@@ -25,7 +25,7 @@ use crossterm::{
QueueableCommand,
};
-use crate::display::{color_mode::ColorMode, error::DisplayError, size::Size, tui::Tui, utils::detect_color_mode};
+use crate::display::{utils::detect_color_mode, ColorMode, DisplayError, Size, Tui};
/// A thin wrapper over the [Crossterm library](https://github.com/crossterm-rs/crossterm).
#[derive(Debug)]
diff --git a/src/display/tui.rs b/src/display/tui.rs
index a95d605..65248b8 100644
--- a/src/display/tui.rs
+++ b/src/display/tui.rs
@@ -1,6 +1,6 @@
use crossterm::style::Colors;
-use crate::display::{color_mode::ColorMode, DisplayError, Size};
+use crate::display::{ColorMode, DisplayError, Size};
/// An interface that describes interactions with a terminal interface.
pub(crate) trait Tui {
diff --git a/src/display/utils.rs b/src/display/utils.rs
index 0785d05..25c80bc 100644
--- a/src/display/utils.rs
+++ b/src/display/utils.rs
@@ -2,7 +2,7 @@ use std::env::var;
use crate::{
config::Color,
- display::{color_mode::ColorMode, Color as CrosstermColor, Colors},
+ display::{Color as CrosstermColor, ColorMode, Colors},
};
pub(super) fn detect_color_mode(number_of_colors: u16) -> ColorMode {
diff --git a/src/git.rs b/src/git.rs
index 6ae7b9a..7d425ff 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -14,7 +14,7 @@ mod commit_diff_loader;
mod commit_diff_loader_options;
mod delta;
mod diff_line;
-pub(crate) mod errors;
+mod errors;
mod file_mode;
mod file_status;
mod file_status_builder;
@@ -32,11 +32,14 @@ pub(crate) use git2::{Config, ErrorCode};
pub(crate) use self::{
commit::Commit,
commit_diff::CommitDiff,
+ commit_diff_loader::CommitDiffLoader,
commit_diff_loader_options::CommitDiffLoaderOptions,
delta::Delta,
diff_line::DiffLine,
+ errors::{GitError, RepositoryLoadKind},
file_mode::FileMode,
file_status::FileStatus,
+ file_status_builder::FileStatusBuilder,
origin::Origin,
reference::Reference,
reference_kind::ReferenceKind,
diff --git a/src/git/commit.rs b/src/git/commit.rs
index f0af655..4fe45c6 100644
--- a/src/git/commit.rs
+++ b/src/git/commit.rs
@@ -1,6 +1,6 @@
use chrono::{DateTime, Local, TimeZone};
-use crate::git::{errors::GitError, reference::Reference, user::User};
+use crate::git::{GitError, Reference, User};
/// Represents a commit.
#[derive(Debug, PartialEq, Eq)]
diff --git a/src/git/commit_diff.rs b/src/git/commit_diff.rs
index e6495a6..243e582 100644
--- a/src/git/commit_diff.rs
+++ b/src/git/commit_diff.rs
@@ -1,4 +1,4 @@
-use crate::git::{commit::Commit, file_status::FileStatus};
+use crate::git::{Commit, FileStatus};
/// Represents a commit with a diff
#[derive(Debug)]
@@ -54,14 +54,14 @@ mod tests {
use claims::assert_some_eq;
use crate::git::{
- delta::Delta,
- diff_line::DiffLine,
- file_mode::FileMode,
- file_status::FileStatus,
- file_status_builder::FileStatusBuilder,
- status::Status,
testutil::{CommitBuilder, CommitDiffBuilder},
+ Delta,
+ DiffLine,
+ FileMode,
+ FileStatus,
+ FileStatusBuilder,
Origin,
+ Status,
};
#[test]
diff --git a/src/git/commit_diff_loader.rs b/src/git/commit_diff_loader.rs
index a7cb65a..ff67d0f 100644
--- a/src/git/commit_diff_loader.rs
+++ b/src/git/commit_diff_loader.rs
@@ -5,15 +5,15 @@ use lazy_static::lazy_static;
use parking_lot::{Mutex, MutexGuard};
use crate::git::{
- commit::Commit,
- commit_diff::CommitDiff,
- commit_diff_loader_options::CommitDiffLoaderOptions,
- delta::Delta,
- diff_line::DiffLine,
- file_mode::FileMode,
- file_status::FileStatus,
- file_status_builder::FileStatusBuilder,
- status::Status,
+ Commit,
+ CommitDiff,
+ CommitDiffLoaderOptions,
+ Delta,
+ DiffLine,
+ FileMode,
+ FileStatus,
+ FileStatusBuilder,
+ Status,
};
lazy_static! {
diff --git a/src/git/delta.rs b/src/git/delta.rs
index ac44ec3..41064b2 100644
--- a/src/git/delta.rs
+++ b/src/git/delta.rs
@@ -89,7 +89,7 @@ mod tests {
use claims::assert_err;
use super::*;
- use crate::git::origin::Origin;
+ use crate::git::Origin;
#[test]
fn new_with_correctly_formatted_context() {
diff --git a/src/git/file_status.rs b/src/git/file_status.rs
index 3687432..82fbed4 100644
--- a/src/git/file_status.rs
+++ b/src/git/file_status.rs
@@ -1,6 +1,6 @@
use std::path::{Path, PathBuf};
-use crate::git::{delta::Delta, file_mode::FileMode, status::Status};
+use crate::git::{Delta, FileMode, Status};
/// Represents a file change within a Git repository
#[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/src/git/reference.rs b/src/git/reference.rs
index a7f9c83..804ab1b 100644
--- a/src/git/reference.rs
+++ b/src/git/reference.rs
@@ -1,4 +1,4 @@
-use crate::git::reference_kind::ReferenceKind;
+use crate::git::ReferenceKind;
/// Represents a pointer to an object in Git.
#[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/src/git/repository.rs b/src/git/repository.rs
index dad7636..b542d14 100644
--- a/src/git/repository.rs
+++ b/src/git/repository.rs
@@ -8,13 +8,14 @@ use git2::{Oid, Signature};
use parking_lot::Mutex;
use crate::git::{
- commit_diff_loader::CommitDiffLoader,
- errors::{GitError, RepositoryLoadKind},
Commit,
CommitDiff,
+ CommitDiffLoader,
CommitDiffLoaderOptions,
Config,
+ GitError,
Reference,
+ RepositoryLoadKind,
};
/// A light cloneable, simple wrapper around the `git2::Repository` struct
diff --git a/src/input.rs b/src/input.rs
index 639f452..f74f182 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -21,7 +21,7 @@ mod standard_event;
pub(crate) mod testutil;
mod thread;
-pub(crate) use crossterm::event::{Event as RawEvent, KeyCode, KeyModifiers, MouseEvent, MouseEventKind};
+pub(crate) use crossterm::event::{KeyCode, KeyModifiers, MouseEvent, MouseEventKind};
pub(crate) use self::{
custom_event::CustomEvent,
diff --git a/src/input/event_handler.rs b/src/input/event_handler.rs
index 90a873e..11b280f 100644
--- a/src/input/event_handler.rs
+++ b/src/input/event_handler.rs
@@ -1,4 +1,4 @@
-use crate::input::{key_bindings::KeyBindings, Event, InputOptions, KeyCode, KeyEvent, KeyModifiers, StandardEvent};
+use crate::input::{Event, InputOptions, KeyBindings, KeyCode, KeyEvent, KeyModifiers, StandardEvent};
/// A handler for reading and processing events.
#[derive(Debug)]
diff --git a/src/input/testutil.rs b/src/input/testutil.rs
index 96354b3..bd19319 100644
--- a/src/input/testutil.rs
+++ b/src/input/testutil.rs
@@ -5,7 +5,6 @@ use crossterm::event as c_event;
use crate::input::{
map_keybindings,
- thread::State,
Event,
EventHandler,
EventReaderFn,
@@ -13,6 +12,7 @@ use crate::input::{
KeyCode,
KeyEvent,
KeyModifiers,
+ State,
};
#[cfg(test)]
diff --git a/src/input/thread.rs b/src/input/thread.rs
index 531cc85..9339278 100644
--- a/src/input/thread.rs
+++ b/src/input/thread.rs
@@ -7,10 +7,10 @@ use std::{
};
use captur::capture;
-pub(crate) use state::State;
+pub(crate) use self::state::State;
use crate::{
- input::{event::Event, event_provider::EventReaderFn},
+ input::{Event, EventReaderFn},
runtime::{Installer, Threadable},
};
diff --git a/src/modules/list/tests/toggle_break.rs b/src/modules/list/tests/toggle_break.rs
index 2f45c02..92bb636 100644
--- a/src/modules/list/tests/toggle_break.rs
+++ b/src/modules/list/tests/toggle_break.rs
@@ -3,7 +3,7 @@ use crate::{
action_line,
assert_rendered_output,
testutil::module_test,
- todo_file::{errors::ParseError, Action::Pick},
+ todo_file::{Action::Pick, ParseError},
view::testutil::LinePattern,
};
diff --git a/src/process.rs b/src/process.rs
index cbfc885..0d6591b 100644
--- a/src/process.rs
+++ b/src/process.rs
@@ -2,7 +2,7 @@ mod artifact;
mod results;
#[cfg(test)]
mod tests;
-pub(crate) mod thread;
+mod thread;
use std::{
io::ErrorKind,
@@ -26,7 +26,7 @@ use crate::{
runtime::ThreadStatuses,
search::{self, Action, Searchable},
todo_file::TodoFile,
- view::{RenderContext, State as ViewState},
+ view::RenderContext,
};
pub(crate) struct Process<ModuleProvider: module::ModuleProvider> {
diff --git a/src/process/results.rs b/src/process/results.rs
index 0fac5ab..6abb4fe 100644
--- a/src/process/results.rs
+++ b/src/process/results.rs
@@ -5,7 +5,7 @@ use anyhow::Error;
use crate::{
events::Event,
module::{ExitStatus, State},
- process::artifact::Artifact,
+ process::Artifact,
search::Searchable,
};
diff --git a/src/runtime.rs b/src/runtime.rs
index 331dbbb..69c10b4 100644
--- a/src/runtime.rs
+++ b/src/runtime.rs
@@ -19,7 +19,7 @@ pub(crate) mod testutils;
mod thread_statuses;
mod threadable;
-pub(crate) use crate::runtime::{
+pub(crate) use self::{
errors::RuntimeError,
installer::Installer,
notifier::Notifier,
diff --git a/src/runtime/notifier.rs b/src/runtime/notifier.rs
index b9f7f5d..acc3048 100644
--- a/src/runtime/notifier.rs
+++ b/src/runtime/notifier.rs
@@ -1,6 +1,6 @@
use crossbeam_channel::Sender;
-use crate::runtime::{status::Status, RuntimeError};
+use crate::runtime::{RuntimeError, Status};
/// A thread status notifier, that allows a thread to notify the `Runtime` of the current status of the thread.
#[derive(Debug)]
diff --git a/src/runtime/threadable.rs b/src/runtime/threadable.rs
index c37f8d6..83b78a4 100644
--- a/src/runtime/threadable.rs
+++ b/src/runtime/threadable.rs
@@ -1,4 +1,4 @@
-use crate::runtime::installer::Installer;
+use crate::runtime::Installer;
/// An interface for a entity that has threads managed by the `Runtime`.
pub(crate) trait Threadable: Send {
diff --git a/src/search.rs b/src/search.rs
index 767b11b..3a8d18f 100644
--- a/src/search.rs
+++ b/src/search.rs
@@ -11,7 +11,6 @@ pub(crate) use self::{
action::Action,
interrupter::Interrupter,
search_result::SearchResult,
- search_state::SearchState,
searchable::Searchable,
state::State,
thread::Thread,
diff --git a/src/search/action.rs b/src/search/action.rs
index 80a7468..7874949 100644
--- a/src/search/action.rs
+++ b/src/search/action.rs
@@ -1,6 +1,6 @@
use std::fmt::{Debug, Formatter};
-use crate::search::searchable::Searchable;
+use crate::search::Searchable;
#[allow(clippy::exhaustive_enums)]
pub(crate) enum Action {
diff --git a/src/search/state.rs b/src/search/state.rs
index c3dbdc8..0f0d76a 100644
--- a/src/search/state.rs
+++ b/src/search/state.rs
@@ -8,7 +8,7 @@ use std::{
use crossbeam_channel::RecvTimeoutError;
-use crate::search::action::Action;
+use crate::search::Action;
const RECEIVE_TIMEOUT: Duration = Duration::from_millis(500);
diff --git a/src/search/thread.rs b/src/search/thread.rs
index 60d54e8..f81335a 100644
--- a/src/search/thread.rs
+++ b/src/search/thread.rs
@@ -8,14 +8,7 @@ use captur::capture;
use crate::{
runtime::{Installer, Threadable},
- search::{
- action::Action,
- interrupter::Interrupter,
- search_result::SearchResult,
- searchable::Searchable,
- State,
- UpdateHandlerFn,
- },
+ search::{Action, Interrupter, SearchResult, Searchable, State, UpdateHandlerFn},
};
pub(crate) const THREAD_NAME: &str = "search";
diff --git a/src/testutil/action_line.rs b/src/testutil/action_line.rs
index 6246188..1295b84 100644
--- a/src/testutil/action_line.rs
+++ b/src/testutil/action_line.rs
@@ -2,7 +2,7 @@ use lazy_static::lazy_static;
use regex::Regex;
use crate::{
- todo_file::{errors::ParseError, Line},
+ todo_file::{Line, ParseError},
view::testutil::{replace_invisibles, LinePattern},
};
diff --git a/src/todo_file.rs b/src/todo_file.rs
index 5f4c12f..9c0a32d 100644
--- a/src/todo_file.rs
+++ b/src/todo_file.rs
@@ -5,7 +5,7 @@
mod action;
mod edit_content;
-pub(crate) mo