Skip to content

Commit 6f10b2b

Browse files
committed
Updating linting and rustfmt configs to latest
1 parent bdf2f38 commit 6f10b2b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+554
-360
lines changed

.rustfmt.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
#array_width - allow use_small_heuristics
2-
#attr_fn_like_width - allow use_small_heuristics
1+
# array_width - allow use_small_heuristics
2+
# attr_fn_like_width - allow use_small_heuristics
33
binop_separator = "Front"
44
blank_lines_lower_bound = 0
55
blank_lines_upper_bound = 1
66
brace_style = "SameLineWhere"
7-
#chain_width - allow use_small_heuristics
7+
# chain_width - allow use_small_heuristics
88
color = "Auto"
99
combine_control_expr = false
1010
comment_width = 120
1111
condense_wildcard_suffixes = true
1212
control_brace_style = "ClosingNextLine"
1313
disable_all_formatting = false
14-
# edition - allow default
14+
# edition - allow default read from Cargo.toml
1515
empty_item_single_line = true
1616
enum_discrim_align_threshold = 0
1717
error_on_line_overflow = true
1818
error_on_unformatted = true
19-
fn_args_layout = "Tall"
20-
#fn_call_width - allow use_small_heuristics
19+
# fn_args_layout = "Tall" - Deprecated, see fn_params_layout
20+
# fn_call_width - allow use_small_heuristics
21+
fn_params_layout = "Tall"
2122
fn_single_line = false
2223
force_explicit_abi = true
2324
force_multiline_blocks = true
@@ -26,6 +27,7 @@ doc_comment_code_block_width = 120
2627
format_generated_files = false
2728
format_macro_matchers = true
2829
format_macro_bodies = true
30+
skip_macro_invocations = []
2931
format_strings = true
3032
hard_tabs = true
3133
hex_literal_case = "Upper"
@@ -55,6 +57,7 @@ reorder_modules = true
5557
short_array_element_width_threshold = 8
5658
skip_children = false
5759
# single_line_if_else_max_width - allow use_small_heuristics
60+
# single_line_let_else_max_width - allow use_small_heuristics
5861
space_after_colon = true
5962
space_before_colon = false
6063
spaces_around_ranges = false

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/data/ignored-lints.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
This file contains any lints from rustc that have not been added, and why.
2+
3+
box-pointers - This project uses Box pointers, and it is safe to do so
4+
unstable-features - This is deprecated, and this project doesn't depend on it
5+
6+
Unstable lints:
7+
fuzzy-provenance-casts
8+
lossy-provenance-casts
9+
multiple-supertrait-upcastable
10+
must-not-suspend

scripts/data/lints.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
deprecated_in_future,
1919
elided_lifetimes_in_paths,
2020
explicit_outlives_requirements,
21+
ffi_unwind_calls,
2122
keyword_idents,
23+
let_underscore_drop,
2224
macro_use_extern_crate,
2325
meta_variable_misuse,
2426
missing_abi,
@@ -38,20 +40,21 @@
3840
unreachable_pub,
3941
unsafe_code,
4042
unsafe_op_in_unsafe_fn,
41-
unstable_features,
4243
unused_crate_dependencies,
4344
unused_extern_crates,
4445
unused_import_braces,
4546
unused_lifetimes,
4647
unused_macro_rules,
4748
unused_qualifications,
4849
unused_results,
50+
unused_tuple_struct_fields,
4951
variant_size_differences
5052
)]
5153
// enable all of Clippy's lints
5254
#![deny(clippy::all, clippy::cargo, clippy::pedantic, clippy::restriction)]
5355
#![cfg_attr(include_nightly_lints, deny(clippy::nursery))]
5456
#![allow(
57+
clippy::arithmetic_side_effects,
5558
clippy::arithmetic_side_effects,
5659
clippy::blanket_clippy_restriction_lints,
5760
clippy::bool_to_int_with_if,
@@ -61,7 +64,6 @@
6164
clippy::float_arithmetic,
6265
clippy::implicit_return,
6366
clippy::indexing_slicing,
64-
clippy::integer_arithmetic,
6567
clippy::map_err_ignore,
6668
clippy::missing_docs_in_private_items,
6769
clippy::missing_trait_methods,
@@ -71,10 +73,13 @@
7173
clippy::non_ascii_literal,
7274
clippy::option_if_let_else,
7375
clippy::pub_use,
76+
clippy::question_mark_used,
7477
clippy::redundant_pub_crate,
78+
clippy::ref_patterns,
7579
clippy::std_instead_of_alloc,
7680
clippy::std_instead_of_core,
7781
clippy::tabs_in_doc_comments,
82+
clippy::tests_outside_test_module,
7883
clippy::too_many_lines,
7984
clippy::unwrap_used
8085
)]
@@ -91,9 +96,10 @@
9196
#![cfg_attr(
9297
test,
9398
allow(
99+
let_underscore_drop,
94100
clippy::cognitive_complexity,
95-
clippy::let_underscore_drop,
96101
clippy::let_underscore_must_use,
102+
clippy::let_underscore_untyped,
97103
clippy::needless_pass_by_value,
98104
clippy::panic,
99105
clippy::shadow_reuse,
@@ -104,4 +110,14 @@
104110
)
105111
)]
106112
// allowable upcoming nightly lints
107-
#![cfg_attr(include_nightly_lints, allow(clippy::semicolon_outside_block))]
113+
#![cfg_attr(
114+
include_nightly_lints,
115+
allow(
116+
clippy::arc_with_non_send_sync,
117+
clippy::min_ident_chars,
118+
clippy::needless_raw_strings,
119+
clippy::pub_with_shorthand,
120+
clippy::redundant_closure_call,
121+
clippy::single_call_fn
122+
)
123+
)]

src/config/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ name = "config"
1717
[dependencies]
1818
thiserror = "1.0.38"
1919
girt-git = {version = "2.2.0", path = "../../src/git"}
20+
proc-macro2 = "1.0.64" # TODO: remove override of indirect dependency
2021

2122
[dev-dependencies]
2223
claim = { git = "https://github.com/Turbo87/rust-claim.git", rev = "23892a3" }

src/config/src/git_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ mod tests {
152152
#[test]
153153
fn try_from_git_config_error() {
154154
with_git_config(&["[diff]", "renames = invalid"], |git_config| {
155-
let _ = GitConfig::try_from(&git_config).unwrap_err();
155+
_ = GitConfig::try_from(&git_config).unwrap_err();
156156
});
157157
}
158158

src/config/src/key_bindings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ mod tests {
245245
#[test]
246246
fn try_from_git_config_error() {
247247
with_git_config(&["[interactive-rebase-tool]", "inputAbort = invalid"], |git_config| {
248-
let _ = KeyBindings::try_from(&git_config).unwrap_err();
248+
_ = KeyBindings::try_from(&git_config).unwrap_err();
249249
});
250250
}
251251

src/config/src/lib.rs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
deprecated_in_future,
2020
elided_lifetimes_in_paths,
2121
explicit_outlives_requirements,
22+
ffi_unwind_calls,
2223
keyword_idents,
24+
let_underscore_drop,
2325
macro_use_extern_crate,
2426
meta_variable_misuse,
2527
missing_abi,
@@ -39,20 +41,21 @@
3941
unreachable_pub,
4042
unsafe_code,
4143
unsafe_op_in_unsafe_fn,
42-
unstable_features,
4344
unused_crate_dependencies,
4445
unused_extern_crates,
4546
unused_import_braces,
4647
unused_lifetimes,
4748
unused_macro_rules,
4849
unused_qualifications,
4950
unused_results,
51+
unused_tuple_struct_fields,
5052
variant_size_differences
5153
)]
5254
// enable all of Clippy's lints
5355
#![deny(clippy::all, clippy::cargo, clippy::pedantic, clippy::restriction)]
5456
#![cfg_attr(include_nightly_lints, deny(clippy::nursery))]
5557
#![allow(
58+
clippy::arithmetic_side_effects,
5659
clippy::arithmetic_side_effects,
5760
clippy::blanket_clippy_restriction_lints,
5861
clippy::bool_to_int_with_if,
@@ -62,7 +65,6 @@
6265
clippy::float_arithmetic,
6366
clippy::implicit_return,
6467
clippy::indexing_slicing,
65-
clippy::integer_arithmetic,
6668
clippy::map_err_ignore,
6769
clippy::missing_docs_in_private_items,
6870
clippy::missing_trait_methods,
@@ -72,10 +74,13 @@
7274
clippy::non_ascii_literal,
7375
clippy::option_if_let_else,
7476
clippy::pub_use,
77+
clippy::question_mark_used,
7578
clippy::redundant_pub_crate,
79+
clippy::ref_patterns,
7680
clippy::std_instead_of_alloc,
7781
clippy::std_instead_of_core,
7882
clippy::tabs_in_doc_comments,
83+
clippy::tests_outside_test_module,
7984
clippy::too_many_lines,
8085
clippy::unwrap_used
8186
)]
@@ -92,9 +97,10 @@
9297
#![cfg_attr(
9398
test,
9499
allow(
100+
let_underscore_drop,
95101
clippy::cognitive_complexity,
96-
clippy::let_underscore_drop,
97102
clippy::let_underscore_must_use,
103+
clippy::let_underscore_untyped,
98104
clippy::needless_pass_by_value,
99105
clippy::panic,
100106
clippy::shadow_reuse,
@@ -105,7 +111,17 @@
105111
)
106112
)]
107113
// allowable upcoming nightly lints
108-
#![cfg_attr(include_nightly_lints, allow(clippy::semicolon_outside_block))]
114+
#![cfg_attr(
115+
include_nightly_lints,
116+
allow(
117+
clippy::arc_with_non_send_sync,
118+
clippy::min_ident_chars,
119+
clippy::needless_raw_strings,
120+
clippy::pub_with_shorthand,
121+
clippy::redundant_closure_call,
122+
clippy::single_call_fn
123+
)
124+
)]
109125
// LINT-REPLACE-END
110126

111127
//! Git Interactive Rebase Tool - Configuration Module
@@ -136,6 +152,8 @@ mod utils;
136152
mod testutils;
137153

138154
use git::Repository;
155+
// TODO: remove override of indirect dependency
156+
use proc_macro2 as _;
139157

140158
use self::utils::{get_bool, get_diff_ignore_whitespace, get_diff_show_whitespace, get_string, get_unsigned_integer};
141159
pub use self::{
@@ -274,7 +292,7 @@ mod tests {
274292
with_git_config(
275293
&["[interactive-rebase-tool]", "autoSelectNext = invalid"],
276294
|git_config| {
277-
let _ = Config::try_from(&git_config).unwrap_err();
295+
_ = Config::try_from(&git_config).unwrap_err();
278296
},
279297
);
280298
}

src/config/src/utils/get_string.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use git::{Config, ErrorCode};
33
use crate::{ConfigError, ConfigErrorCause};
44

55
pub(crate) fn _get_string(config: Option<&Config>, name: &str) -> Result<Option<String>, ConfigError> {
6-
let Some(cfg) = config else {
6+
let Some(cfg) = config
7+
else {
78
return Ok(None);
89
};
910
match cfg.get_string(name) {

src/core/src/application.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,12 @@ where ModuleProvider: module::ModuleProvider + Send + 'static
9999
}
100100

101101
pub(crate) fn run_until_finished(&mut self) -> Result<(), Exit> {
102-
let Some(mut threads) = self.threads.take() else {
103-
return Err(Exit::new(ExitStatus::StateError, "Attempt made to run application a second time"));
102+
let Some(mut threads) = self.threads.take()
103+
else {
104+
return Err(Exit::new(
105+
ExitStatus::StateError,
106+
"Attempt made to run application a second time",
107+
));
104108
};
105109

106110
let runtime = Runtime::new();
@@ -230,7 +234,7 @@ mod tests {
230234
#[test]
231235
#[serial_test::serial]
232236
fn load_repository_failure() {
233-
let _ = set_git_directory("fixtures/not-a-repository");
237+
_ = set_git_directory("fixtures/not-a-repository");
234238
let event_provider = create_event_reader(|| Ok(None));
235239
let application: Result<Application<TestModuleProvider<DefaultTestModule>>, Exit> =
236240
Application::new(&args(&["todofile"]), event_provider, create_mocked_crossterm());
@@ -247,7 +251,7 @@ mod tests {
247251
#[test]
248252
#[serial_test::serial]
249253
fn load_config_failure() {
250-
let _ = set_git_directory("fixtures/invalid-config");
254+
_ = set_git_directory("fixtures/invalid-config");
251255
let event_provider = create_event_reader(|| Ok(None));
252256
let application: Result<Application<TestModuleProvider<DefaultTestModule>>, Exit> =
253257
Application::new(&args(&["rebase-todo"]), event_provider, create_mocked_crossterm());
@@ -258,7 +262,7 @@ mod tests {
258262
#[test]
259263
#[serial_test::serial]
260264
fn load_todo_file_load_error() {
261-
let _ = set_git_directory("fixtures/simple");
265+
_ = set_git_directory("fixtures/simple");
262266
let event_provider = create_event_reader(|| Ok(None));
263267
let application: Result<Application<TestModuleProvider<DefaultTestModule>>, Exit> =
264268
Application::new(&args(&["does-not-exist"]), event_provider, create_mocked_crossterm());

0 commit comments

Comments
 (0)