summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Oram <dev@mitmaro.ca>2023-03-06 10:07:43 -0330
committerTim Oram <dev@mitmaro.ca>2023-07-15 11:35:02 -0230
commit6f10b2b5e1e7793f84de54c9609e203df664865c (patch)
treed3de872e1aa5161934c416c5e850c26bf42a95e8
parentbdf2f38066bc394584bc977f8ac1ad9d66aa1130 (diff)
Updating linting and rustfmt configs to latest
-rw-r--r--.rustfmt.toml15
-rw-r--r--Cargo.lock5
-rw-r--r--scripts/data/ignored-lints.txt10
-rw-r--r--scripts/data/lints.rs24
-rw-r--r--src/config/Cargo.toml1
-rw-r--r--src/config/src/git_config.rs2
-rw-r--r--src/config/src/key_bindings.rs2
-rw-r--r--src/config/src/lib.rs28
-rw-r--r--src/config/src/utils/get_string.rs3
-rw-r--r--src/core/src/application.rs14
-rw-r--r--src/core/src/arguments.rs2
-rw-r--r--src/core/src/components/choice/tests.rs2
-rw-r--r--src/core/src/components/edit/mod.rs2
-rw-r--r--src/core/src/components/shared/editable_line.rs20
-rw-r--r--src/core/src/lib.rs24
-rw-r--r--src/core/src/module/module_handler.rs10
-rw-r--r--src/core/src/module/modules.rs32
-rw-r--r--src/core/src/modules/error/mod.rs14
-rw-r--r--src/core/src/modules/external_editor/tests.rs62
-rw-r--r--src/core/src/modules/insert/mod.rs2
-rw-r--r--src/core/src/modules/insert/tests.rs16
-rw-r--r--src/core/src/modules/list/mod.rs22
-rw-r--r--src/core/src/modules/list/tests/abort_and_rebase.rs8
-rw-r--r--src/core/src/modules/list/tests/change_action.rs26
-rw-r--r--src/core/src/modules/list/tests/edit_mode.rs6
-rw-r--r--src/core/src/modules/list/tests/external_editor.rs4
-rw-r--r--src/core/src/modules/list/tests/help.rs8
-rw-r--r--src/core/src/modules/list/tests/mod.rs2
-rw-r--r--src/core/src/modules/list/tests/movement.rs38
-rw-r--r--src/core/src/modules/list/tests/normal_mode.rs2
-rw-r--r--src/core/src/modules/list/tests/remove_lines.rs12
-rw-r--r--src/core/src/modules/list/tests/search.rs36
-rw-r--r--src/core/src/modules/list/tests/swap_lines.rs20
-rw-r--r--src/core/src/modules/list/tests/toggle_break.rs6
-rw-r--r--src/core/src/modules/list/tests/toggle_option.rs12
-rw-r--r--src/core/src/modules/list/tests/undo_redo.rs18
-rw-r--r--src/core/src/modules/list/tests/visual_mode.rs16
-rw-r--r--src/core/src/modules/list/utils.rs1
-rw-r--r--src/core/src/modules/show_commit/tests.rs6
-rw-r--r--src/core/src/modules/window_size_error/mod.rs6
-rw-r--r--src/core/src/process/mod.rs2
-rw-r--r--src/core/src/process/results.rs2
-rw-r--r--src/core/src/process/tests.rs28
-rw-r--r--src/core/src/search/thread.rs19
-rw-r--r--src/display/src/lib.rs24
-rw-r--r--src/display/src/testutil/mod.rs1
-rw-r--r--src/git/src/commit.rs2
-rw-r--r--src/git/src/commit_diff_loader.rs6
-rw-r--r--src/git/src/file_status_builder.rs8
-rw-r--r--src/git/src/lib.rs24
-rw-r--r--src/git/src/reference_kind.rs6
-rw-r--r--src/git/src/repository.rs4
-rw-r--r--src/git/src/testutil/with_temp_repository.rs6
-rw-r--r--src/input/src/event_provider.rs38
-rw-r--r--src/input/src/key_bindings.rs2
-rw-r--r--src/input/src/lib.rs24
-rw-r--r--src/input/src/thread/state.rs4
-rw-r--r--src/main.rs24
-rw-r--r--src/runtime/src/installer.rs4
-rw-r--r--src/runtime/src/lib.rs24
-rw-r--r--src/runtime/src/thread_statuses.rs2
-rw-r--r--src/testutils/src/lib.rs24
-rw-r--r--src/todo_file/src/lib.rs34
-rw-r--r--src/todo_file/src/line_parser.rs14
-rw-r--r--src/todo_file/src/testutil.rs2
-rw-r--r--src/view/src/lib.rs24
-rw-r--r--src/view/src/line_segment.rs4
-rw-r--r--src/view/src/render_slice/mod.rs2
-rw-r--r--src/view/src/render_slice/tests.rs2
-rw-r--r--src/view/src/testutil.rs6
-rw-r--r--src/view/src/thread/mod.rs9
71 files changed, 554 insertions, 360 deletions
diff --git a/.rustfmt.toml b/.rustfmt.toml
index 429243f..79f9d57 100644
--- a/.rustfmt.toml
+++ b/.rustfmt.toml
@@ -1,23 +1,24 @@
-#array_width - allow use_small_heuristics
-#attr_fn_like_width - allow use_small_heuristics
+# array_width - allow use_small_heuristics
+# attr_fn_like_width - allow use_small_heuristics
binop_separator = "Front"
blank_lines_lower_bound = 0
blank_lines_upper_bound = 1
brace_style = "SameLineWhere"
-#chain_width - allow use_small_heuristics
+# chain_width - allow use_small_heuristics
color = "Auto"
combine_control_expr = false
comment_width = 120
condense_wildcard_suffixes = true
control_brace_style = "ClosingNextLine"
disable_all_formatting = false
-# edition - allow default
+# edition - allow default read from Cargo.toml
empty_item_single_line = true
enum_discrim_align_threshold = 0
error_on_line_overflow = true
error_on_unformatted = true
-fn_args_layout = "Tall"
-#fn_call_width - allow use_small_heuristics
+# fn_args_layout = "Tall" - Deprecated, see fn_params_layout
+# fn_call_width - allow use_small_heuristics
+fn_params_layout = "Tall"
fn_single_line = false
force_explicit_abi = true
force_multiline_blocks = true
@@ -26,6 +27,7 @@ doc_comment_code_block_width = 120
format_generated_files = false
format_macro_matchers = true
format_macro_bodies = true
+skip_macro_invocations = []
format_strings = true
hard_tabs = true
hex_literal_case = "Upper"
@@ -55,6 +57,7 @@ reorder_modules = true
short_array_element_width_threshold = 8
skip_children = false
# single_line_if_else_max_width - allow use_small_heuristics
+# single_line_let_else_max_width - allow use_small_heuristics
space_after_colon = true
space_before_colon = false
spaces_around_ranges = false
diff --git a/Cargo.lock b/Cargo.lock
index 10d647e..8ccf5fa 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -296,6 +296,7 @@ dependencies = [
"girt-git",
"girt-testutils",
"lazy_static",
+ "proc-macro2",
"rstest",
"rustc_version",
"serial_test",
@@ -739,9 +740,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.47"
+version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
+checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da"
dependencies = [
"unicode-ident",
]
diff --git a/scripts/data/ignored-lints.txt b/scripts/data/ignored-lints.txt
new file mode 100644
index 0000000..8d4e4cf
--- /dev/null
+++ b/scripts/data/ignored-lints.txt
@@ -0,0 +1,10 @@
+This file contains any lints from rustc that have not been added, and why.
+
+box-pointers - This project uses Box pointers, and it is safe to do so
+unstable-features - This is deprecated, and this project doesn't depend on it
+
+Unstable lints:
+ fuzzy-provenance-casts
+ lossy-provenance-casts
+ multiple-supertrait-upcastable
+ must-not-suspend
diff --git a/scripts/data/lints.rs b/scripts/data/lints.rs
index af4518c..b33c70f 100644
--- a/scripts/data/lints.rs
+++ b/scripts/data/lints.rs
@@ -18,7 +18,9 @@
deprecated_in_future,
elided_lifetimes_in_paths,
explicit_outlives_requirements,
+ ffi_unwind_calls,
keyword_idents,
+ let_underscore_drop,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
@@ -38,7 +40,6 @@
unreachable_pub,
unsafe_code,
unsafe_op_in_unsafe_fn,
- unstable_features,
unused_crate_dependencies,
unused_extern_crates,
unused_import_braces,
@@ -46,6 +47,7 @@
unused_macro_rules,
unused_qualifications,
unused_results,
+ unused_tuple_struct_fields,
variant_size_differences
)]
// enable all of Clippy's lints
@@ -53,6 +55,7 @@
#![cfg_attr(include_nightly_lints, deny(clippy::nursery))]
#![allow(
clippy::arithmetic_side_effects,
+ clippy::arithmetic_side_effects,
clippy::blanket_clippy_restriction_lints,
clippy::bool_to_int_with_if,
clippy::default_numeric_fallback,
@@ -61,7 +64,6 @@
clippy::float_arithmetic,
clippy::implicit_return,
clippy::indexing_slicing,
- clippy::integer_arithmetic,
clippy::map_err_ignore,
clippy::missing_docs_in_private_items,
clippy::missing_trait_methods,
@@ -71,10 +73,13 @@
clippy::non_ascii_literal,
clippy::option_if_let_else,
clippy::pub_use,
+ clippy::question_mark_used,
clippy::redundant_pub_crate,
+ clippy::ref_patterns,
clippy::std_instead_of_alloc,
clippy::std_instead_of_core,
clippy::tabs_in_doc_comments,
+ clippy::tests_outside_test_module,
clippy::too_many_lines,
clippy::unwrap_used
)]
@@ -91,9 +96,10 @@
#![cfg_attr(
test,
allow(
+ let_underscore_drop,
clippy::cognitive_complexity,
- clippy::let_underscore_drop,
clippy::let_underscore_must_use,
+ clippy::let_underscore_untyped,
clippy::needless_pass_by_value,
clippy::panic,
clippy::shadow_reuse,
@@ -104,4 +110,14 @@
)
)]
// allowable upcoming nightly lints
-#![cfg_attr(include_nightly_lints, allow(clippy::semicolon_outside_block))]
+#![cfg_attr(
+ include_nightly_lints,
+ allow(
+ clippy::arc_with_non_send_sync,
+ clippy::min_ident_chars,
+ clippy::needless_raw_strings,
+ clippy::pub_with_shorthand,
+ clippy::redundant_closure_call,
+ clippy::single_call_fn
+ )
+)]
diff --git a/src/config/Cargo.toml b/src/config/Cargo.toml
index dabf43a..e0f0cf1 100644
--- a/src/config/Cargo.toml
+++ b/src/config/Cargo.toml
@@ -17,6 +17,7 @@ name = "config"
[dependencies]
thiserror = "1.0.38"
girt-git = {version = "2.2.0", path = "../../src/git"}
+proc-macro2 = "1.0.64" # TODO: remove override of indirect dependency
[dev-dependencies]
claim = { git = "https://github.com/Turbo87/rust-claim.git", rev = "23892a3" }
diff --git a/src/config/src/git_config.rs b/src/config/src/git_config.rs
index e1b29b3..39beb15 100644
--- a/src/config/src/git_config.rs
+++ b/src/config/src/git_config.rs
@@ -152,7 +152,7 @@ mod tests {
#[test]
fn try_from_git_config_error() {
with_git_config(&["[diff]", "renames = invalid"], |git_config| {
- let _ = GitConfig::try_from(&git_config).unwrap_err();
+ _ = GitConfig::try_from(&git_config).unwrap_err();
});
}
diff --git a/src/config/src/key_bindings.rs b/src/config/src/key_bindings.rs
index ce6fd26..341082a 100644
--- a/src/config/src/key_bindings.rs
+++ b/src/config/src/key_bindings.rs
@@ -245,7 +245,7 @@ mod tests {
#[test]
fn try_from_git_config_error() {
with_git_config(&["[interactive-rebase-tool]", "inputAbort = invalid"], |git_config| {
- let _ = KeyBindings::try_from(&git_config).unwrap_err();
+ _ = KeyBindings::try_from(&git_config).unwrap_err();
});
}
diff --git a/src/config/src/lib.rs b/src/config/src/lib.rs
index 128f2f7..8c02d74 100644
--- a/src/config/src/lib.rs
+++ b/src/config/src/lib.rs
@@ -19,7 +19,9 @@
deprecated_in_future,
elided_lifetimes_in_paths,
explicit_outlives_requirements,
+ ffi_unwind_calls,
keyword_idents,
+ let_underscore_drop,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
@@ -39,7 +41,6 @@
unreachable_pub,
unsafe_code,
unsafe_op_in_unsafe_fn,
- unstable_features,
unused_crate_dependencies,
unused_extern_crates,
unused_import_braces,
@@ -47,6 +48,7 @@
unused_macro_rules,
unused_qualifications,
unused_results,
+ unused_tuple_struct_fields,
variant_size_differences
)]
// enable all of Clippy's lints
@@ -54,6 +56,7 @@
#![cfg_attr(include_nightly_lints, deny(clippy::nursery))]
#![allow(
clippy::arithmetic_side_effects,
+ clippy::arithmetic_side_effects,
clippy::blanket_clippy_restriction_lints,
clippy::bool_to_int_with_if,
clippy::default_numeric_fallback,
@@ -62,7 +65,6 @@
clippy::float_arithmetic,
clippy::implicit_return,
clippy::indexing_slicing,
- clippy::integer_arithmetic,
clippy::map_err_ignore,
clippy::missing_docs_in_private_items,
clippy::missing_trait_methods,
@@ -72,10 +74,13 @@
clippy::non_ascii_literal,
clippy::option_if_let_else,
clippy::pub_use,
+ clippy::question_mark_used,
clippy::redundant_pub_crate,
+ clippy::ref_patterns,
clippy::std_instead_of_alloc,
clippy::std_instead_of_core,
clippy::tabs_in_doc_comments,
+ clippy::tests_outside_test_module,
clippy::too_many_lines,
clippy::unwrap_used
)]
@@ -92,9 +97,10 @@
#![cfg_attr(
test,
allow(
+ let_underscore_drop,
clippy::cognitive_complexity,
- clippy::let_underscore_drop,
clippy::let_underscore_must_use,
+ clippy::let_underscore_untyped,
clippy::needless_pass_by_value,
clippy::panic,
clippy::shadow_reuse,
@@ -105,7 +111,17 @@
)
)]
// allowable upcoming nightly lints
-#![cfg_attr(include_nightly_lints, allow(clippy::semicolon_outside_block))]
+#![cfg_attr(
+ include_nightly_lints,
+ allow(
+ clippy::arc_with_non_send_sync,
+ clippy::min_ident_chars,
+ clippy::needless_raw_strings,
+ clippy::pub_with_shorthand,
+ clippy::redundant_closure_call,
+ clippy::single_call_fn
+ )
+)]
// LINT-REPLACE-END
//! Git Interactive Rebase Tool - Configuration Module
@@ -136,6 +152,8 @@ mod utils;
mod testutils;
use git::Repository;
+// TODO: remove override of indirect dependency
+use proc_macro2 as _;
use self::utils::{get_bool, get_diff_ignore_whitespace, get_diff_show_whitespace, get_string, get_unsigned_integer};
pub use self::{
@@ -274,7 +292,7 @@ mod tests {
with_git_config(
&["[interactive-rebase-tool]", "autoSelectNext = invalid"],
|git_config| {
- let _ = Config::try_from(&git_config).unwrap_err();
+ _ = Config::try_from(&git_config).unwrap_err();
},
);
}
diff --git a/src/config/src/utils/get_string.rs b/src/config/src/utils/get_string.rs
index 712d00f..454b484 100644
--- a/src/config/src/utils/get_string.rs
+++ b/src/config/src/utils/get_string.rs
@@ -3,7 +3,8 @@ use git::{Config, ErrorCode};
use crate::{ConfigError, ConfigErrorCause};
pub(crate) fn _get_string(config: Option<&Config>, name: &str) -> Result<Option<String>, ConfigError> {
- let Some(cfg) = config else {
+ let Some(cfg) = config
+ else {
return Ok(None);
};
match cfg.get_string(name) {
diff --git a/src/core/src/application.rs b/src/core/src/application.rs
index 7c66b29..921675a 100644
--- a/src/core/src/application.rs
+++ b/src/core/src/application.rs
@@ -99,8 +99,12 @@ where ModuleProvider: module::ModuleProvider + Send + 'static
}
pub(crate) fn run_until_finished(&mut self) -> Result<(), Exit> {
- let Some(mut threads) = self.threads.take() else {
- return Err(Exit::new(ExitStatus::StateError, "Attempt made to run application a second time"));
+ let Some(mut threads) = self.threads.take()
+ else {
+ return Err(Exit::new(
+ ExitStatus::StateError,
+ "Attempt made to run application a second time",
+ ));
};
let runtime = Runtime::new();
@@ -230,7 +234,7 @@ mod tests {
#[test]
#[serial_test::serial]
fn load_repository_failure() {
- let _ = set_git_directory("fixtures/not-a-repository");
+ _ = set_git_directory("fixtures/not-a-repository");
let event_provider = create_event_reader(|| Ok(None));
let application: Result<Application<TestModuleProvider<DefaultTestModule>>, Exit> =
Application::new(&args(&["todofile"]), event_provider, create_mocked_crossterm());
@@ -247,7 +251,7 @@ mod tests {
#[test]
#[serial_test::serial]
fn load_config_failure() {
- let _ = set_git_directory("fixtures/invalid-config");
+ _ = set_git_directory("fixtures/invalid-config");
let event_provider = create_event_reader(|| Ok(None));
let application: Result<Application<TestModuleProvider<DefaultTestModule>>, Exit> =
Application::new(&args(&["rebase-todo"]), event_provider, create_mocked_crossterm());
@@ -258,7 +262,7 @@ mod tests {
#[test]
#[serial_test::serial]
fn load_todo_file_load_error() {
- let _ = set_git_directory("fixtures/simple");
+ _ = set_git_directory("fixtures/simple");
let event_provider = create_event_reader(|| Ok(None));
let application: Result<Application<TestModuleProvider<DefaultTestModule>>, Exit> =
Application::new(&args(&["does-not-exist"]), event_provider, create_mocked_crossterm());
diff --git a/src/core/src/arguments.rs b/src/core/src/arguments.rs
index 8cfb433..b7ec92f 100644
--- a/src/core/src/arguments.rs
+++ b/src/core/src/arguments.rs
@@ -105,6 +105,6 @@ mod tests {
#[allow(unsafe_code)]
fn todo_file_invalid() {
let args = unsafe { vec![OsString::from(String::from_utf8_unchecked(vec![0xC3, 0x28]))] };
- let _ = Args::try_from(args).unwrap_err();
+ _ = Args::try_from(args).unwrap_err();
}
}
diff --git a/src/core/src/components/choice/tests.rs b/src/core/src/components/choice/tests.rs
index 20c036e..aae68f7 100644
--- a/src/core/src/components/choice/tests.rs
+++ b/src/core/src/components/choice/tests.rs
@@ -102,7 +102,7 @@ fn invalid_selection_character() {
fn event_standard(#[case] event: Event) {
with_view_state(|context| {
let mut module = Choice::new(create_choices());
- let _ = module.handle_event(event, &context.state);
+ _ = module.handle_event(event, &context.state);
assert!(!module.invalid_selection);
});
}
diff --git a/src/core/src/components/edit/mod.rs b/src/core/src/components/edit/mod.rs
index 0ee5f45..a4a93a0 100644
--- a/