diff options
author | Tim Oram <dev@mitmaro.ca> | 2024-02-11 16:05:24 -0330 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2024-02-15 20:27:06 -0330 |
commit | 9ee018c98e3f7615cac4ac1d02e1fbfbabf2d101 (patch) | |
tree | 52f31267a1eb9f17c118de9395ba2f44288db25c | |
parent | b345500c9d76b862edad4ae040bcb3061bd5e47b (diff) |
Cleanup most disabled lints
-rw-r--r-- | Makefile.toml | 3 | ||||
-rw-r--r-- | ignored-lints.txt | 31 | ||||
-rwxr-xr-x | scripts/add-lints.bash | 52 | ||||
-rw-r--r-- | scripts/data/ignored-lints.txt | 10 | ||||
-rw-r--r-- | scripts/data/lints.rs | 120 | ||||
-rw-r--r-- | src/main.rs | 25 | ||||
-rw-r--r-- | src/modules/external_editor.rs | 2 | ||||
-rw-r--r-- | src/modules/show_commit.rs | 2 | ||||
-rw-r--r-- | src/modules/show_commit/util.rs | 2 | ||||
-rw-r--r-- | src/packages/testutils/src/lib.rs | 3 | ||||
-rw-r--r-- | src/process.rs | 1 |
11 files changed, 42 insertions, 209 deletions
diff --git a/Makefile.toml b/Makefile.toml index 828920d..173249a 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -160,9 +160,6 @@ script = [''' cargo +nightly about generate "docs/licenses.hbs" > "docs/licenses.html" '''] -[tasks.add-lints] -command = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/add-lints.bash" - [tasks.publish] command = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/scripts/publish.bash" diff --git a/ignored-lints.txt b/ignored-lints.txt new file mode 100644 index 0000000..529b0e3 --- /dev/null +++ b/ignored-lints.txt @@ -0,0 +1,31 @@ +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 + +Included in lint group: + unused: + unused_macro_rules, + unused_extern_crates + future-incompatible: + pointer_structural_match + let-underscore: + let_underscore_drop + rust_2018_compatibility: + keyword_idents + absolute_paths_not_starting_with_crate + rust_2018_idioms: + unused_extern_crates + elided_lifetimes_in_paths + explicit_outlives_requirements + rust_2021_compatibility: + rust_2021_incompatible_closure_captures, + rust_2021_incompatible_or_patterns, + rust_2021_prefixes_incompatible_syntax, + rust_2021_prelude_collisions, diff --git a/scripts/add-lints.bash b/scripts/add-lints.bash deleted file mode 100755 index 81c325b..0000000 --- a/scripts/add-lints.bash +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -: ' -This script will add to all crates a full list of enabled lints. -' - -files=( - 'src/main.rs' - 'src/config/src/lib.rs' - 'src/core/src/lib.rs' - 'src/display/src/lib.rs' - 'src/git/src/lib.rs' - 'src/input/src/lib.rs' - 'src/runtime/src/lib.rs' - 'src/testutils/src/lib.rs' - 'src/todo_file/src/lib.rs' - 'src/view/src/lib.rs' -) - -# traverse parents until project root is found -project_root= -path="$PWD" -while [[ "$path" != "/" ]]; do - if [[ -f "$path/Cargo.lock" ]]; then - project_root="$path" - break; - else - path="$(dirname "$path")" - fi -done -if [[ -z "$project_root" ]]; then - error "Project root could not be found" - exit 1 -fi - -content="$(cat "$project_root/scripts/data/lints.rs")" -content="${content//$'\n'/\\n}" - -for f in "${files[@]}"; do - awk -i inplace ' - BEGIN {p=1} - /^\/\/ LINT-REPLACE-START/ { - print; - print "'"${content}"'"; - p=0 - } - /^\/\/ LINT-REPLACE-END/ {p=1} - p - ' "$project_root/$f" -done diff --git a/scripts/data/ignored-lints.txt b/scripts/data/ignored-lints.txt deleted file mode 100644 index 8d4e4cf..0000000 --- a/scripts/data/ignored-lints.txt +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100644 index 9af8985..0000000 --- a/scripts/data/lints.rs +++ /dev/null @@ -1,120 +0,0 @@ -// This section is autogenerated, do not modify directly -// nightly sometimes removes/renames lints -#![cfg_attr(allow_unknown_lints, allow(unknown_lints))] -#![cfg_attr(allow_unknown_lints, allow(renamed_and_removed_lints))] -// enable all rustc's built-in lints -#![deny( - future_incompatible, - nonstandard_style, - rust_2018_compatibility, - rust_2018_idioms, - rust_2021_compatibility, - unused, - warnings -)] -// rustc's additional allowed by default lints -#![deny( - absolute_paths_not_starting_with_crate, - 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, - missing_copy_implementations, - missing_debug_implementations, - missing_docs, - non_ascii_idents, - noop_method_call, - pointer_structural_match, - rust_2021_incompatible_closure_captures, - rust_2021_incompatible_or_patterns, - rust_2021_prefixes_incompatible_syntax, - rust_2021_prelude_collisions, - single_use_lifetimes, - trivial_casts, - trivial_numeric_casts, - unreachable_pub, - unsafe_code, - unsafe_op_in_unsafe_fn, - unused_crate_dependencies, - unused_extern_crates, - unused_import_braces, - unused_lifetimes, - unused_macro_rules, - unused_qualifications, - unused_results, - unused_tuple_struct_fields, - variant_size_differences -)] -// enable all of Clippy's lints -#![deny(clippy::all, clippy::cargo, clippy::pedantic, clippy::restriction)] -#![allow( - clippy::absolute_paths, - clippy::arithmetic_side_effects, - clippy::arithmetic_side_effects, - clippy::blanket_clippy_restriction_lints, - clippy::bool_to_int_with_if, - clippy::default_numeric_fallback, - clippy::else_if_without_else, - clippy::expect_used, - clippy::float_arithmetic, - clippy::implicit_return, - clippy::indexing_slicing, - clippy::map_err_ignore, - clippy::min_ident_chars, - clippy::missing_docs_in_private_items, - clippy::missing_trait_methods, - clippy::module_name_repetitions, - clippy::needless_raw_string_hashes, - clippy::needless_raw_strings, - clippy::new_without_default, - clippy::non_ascii_literal, - clippy::option_if_let_else, - clippy::pattern_type_mismatch, - clippy::pub_use, - clippy::pub_with_shorthand, - clippy::question_mark_used, - clippy::redundant_closure_call, - clippy::redundant_pub_crate, - clippy::ref_patterns, - clippy::self_named_module_files, - clippy::single_call_fn, - 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 -)] -#![deny( - rustdoc::bare_urls, - rustdoc::broken_intra_doc_links, - rustdoc::invalid_codeblock_attributes, - rustdoc::invalid_html_tags, - rustdoc::missing_crate_level_docs, - rustdoc::private_doc_tests, - rustdoc::private_intra_doc_links -)] -// allow some things in tests -#![cfg_attr( - test, - allow( - let_underscore_drop, - clippy::cognitive_complexity, - clippy::let_underscore_must_use, - clippy::let_underscore_untyped, - clippy::needless_pass_by_value, - clippy::panic, - clippy::shadow_reuse, - clippy::shadow_unrelated, - clippy::undocumented_unsafe_blocks, - clippy::unimplemented, - clippy::unreachable - ) -)] -// allowable upcoming nightly lints -#![cfg_attr(include_nightly_lints, allow(clippy::absolute_paths, clippy::arc_with_non_send_sync))] diff --git a/src/main.rs b/src/main.rs index 800947f..070914a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,3 @@ -// LINT-REPLACE-START -// This section is autogenerated, do not modify directly // nightly sometimes removes/renames lints #![cfg_attr(allow_unknown_lints, allow(unknown_lints))] #![cfg_attr(allow_unknown_lints, allow(renamed_and_removed_lints))] @@ -27,7 +25,6 @@ missing_abi, missing_copy_implementations, missing_debug_implementations, - missing_docs, non_ascii_idents, noop_method_call, pointer_structural_match, @@ -57,6 +54,7 @@ clippy::absolute_paths, clippy::arithmetic_side_effects, clippy::arithmetic_side_effects, + clippy::as_conversions, clippy::blanket_clippy_restriction_lints, clippy::bool_to_int_with_if, clippy::default_numeric_fallback, @@ -80,6 +78,7 @@ clippy::pub_with_shorthand, clippy::question_mark_used, clippy::redundant_closure_call, + clippy::redundant_closure_for_method_calls, clippy::redundant_pub_crate, clippy::ref_patterns, clippy::self_named_module_files, @@ -89,14 +88,14 @@ clippy::tabs_in_doc_comments, clippy::tests_outside_test_module, clippy::too_many_lines, - clippy::unwrap_used + clippy::unwrap_used, + clippy::wildcard_enum_match_arm )] #![deny( rustdoc::bare_urls, rustdoc::broken_intra_doc_links, rustdoc::invalid_codeblock_attributes, rustdoc::invalid_html_tags, - rustdoc::missing_crate_level_docs, rustdoc::private_doc_tests, rustdoc::private_intra_doc_links )] @@ -105,6 +104,7 @@ test, allow( let_underscore_drop, + clippy::cast_possible_truncation, clippy::cognitive_complexity, clippy::let_underscore_must_use, clippy::let_underscore_untyped, @@ -118,19 +118,8 @@ ) )] // allowable upcoming nightly lints -#![cfg_attr(include_nightly_lints, allow(clippy::absolute_paths, clippy::arc_with_non_send_sync))] -// LINT-REPLACE-END -// TODO deny clippy::same_name_method again once bitflags/bitflags#374 is merged -#![allow( - clippy::as_conversions, - clippy::cast_possible_truncation, - clippy::redundant_closure_for_method_calls, - clippy::same_name_method, - clippy::wildcard_enum_match_arm, - missing_docs, - rustdoc::missing_crate_level_docs, - unused -)] +#![cfg_attr(include_nightly_lints, allow(clippy::arc_with_non_send_sync))] +#![allow(unused)] mod application; mod arguments; diff --git a/src/modules/external_editor.rs b/src/modules/external_editor.rs index 120e6e3..a2aab2f 100644 --- a/src/modules/external_editor.rs +++ b/src/modules/external_editor.rs @@ -19,7 +19,7 @@ use crate::{ module::{ExitStatus, Module, State}, process::Results, todo_file::{Line, TodoFile}, - view::{RenderContext, ViewData, ViewLine}, + view::{RenderContext, ViewData, ViewDataUpdater, ViewLine}, }; lazy_static! { diff --git a/src/modules/show_commit.rs b/src/modules/show_commit.rs index af9134b..3cc7a5e 100644 --- a/src/modules/show_commit.rs +++ b/src/modules/show_commit.rs @@ -27,7 +27,7 @@ use crate::{ select, todo_file::TodoFile, util::handle_view_data_scroll, - view::{RenderContext, ViewData}, + view::{RenderContext, ViewData, ViewDataUpdater}, }; // TODO Remove `union` call when bitflags/bitflags#180 is resolved diff --git a/src/modules/show_commit/util.rs b/src/modules/show_commit/util.rs index 5ca0ba8..ce75523 100644 --- a/src/modules/show_commit/util.rs +++ b/src/modules/show_commit/util.rs @@ -154,7 +154,7 @@ pub(super) fn get_files_changed_summary(diff: &CommitDiff, is_full_width: bool) pub(super) fn get_partition_index_on_whitespace_for_line(line: &str) -> (usize, usize) { let graphemes = UnicodeSegmentation::graphemes(line, true); - let length = graphemes.clone().map(|c| c.len()).sum(); + let length = graphemes.clone().map(str::len).sum(); let mut start_partition_index = 0; let mut end_partition_index = length; diff --git a/src/packages/testutils/src/lib.rs b/src/packages/testutils/src/lib.rs index 862d388..259adff 100644 --- a/src/packages/testutils/src/lib.rs +++ b/src/packages/testutils/src/lib.rs @@ -1,5 +1,3 @@ -// LINT-REPLACE-START -// This section is autogenerated, do not modify directly // nightly sometimes removes/renames lints #![cfg_attr(allow_unknown_lints, allow(unknown_lints))] #![cfg_attr(allow_unknown_lints, allow(renamed_and_removed_lints))] @@ -119,7 +117,6 @@ )] // allowable upcoming nightly lints #![cfg_attr(include_nightly_lints, allow(clippy::absolute_paths, clippy::arc_with_non_send_sync))] -// LINT-REPLACE-END //! Git Interactive Rebase Tool - Test Utils //! diff --git a/src/process.rs b/src/process.rs index 0d6591b..440c3ed 100644 --- a/src/process.rs +++ b/src/process.rs @@ -202,6 +202,7 @@ impl<ModuleProvider: module::ModuleProvider> Process<ModuleProvider> { Results::new() } + #[allow(clippy::cast_possible_truncation)] fn handle_enqueue_resize(&self) -> Results { let render_context = self.render_context.lock(); self.input_state.enqueue_event(Event::Resize( |