diff options
author | Tim Oram <dev@mitmaro.ca> | 2024-05-29 09:30:13 -0230 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2024-05-29 09:38:34 -0230 |
commit | 69dadd8fd363804fea5b06de2df9ab4b04bd2ba6 (patch) | |
tree | 2964b9d6ecd883780b3ffda25ed86331f2fb1507 | |
parent | 5976f3d9bdea217547e74a9440b84b32b7dd2bd4 (diff) |
Address latest linting issues
-rw-r--r-- | Cargo.toml | 51 | ||||
-rw-r--r-- | build.rs | 2 | ||||
-rw-r--r-- | ignored-lints.txt | 31 | ||||
-rw-r--r-- | src/exit.rs | 8 | ||||
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/module/exit_status.rs | 4 |
6 files changed, 45 insertions, 53 deletions
@@ -85,46 +85,64 @@ assets = [ [lints.rust] future_incompatible = { level = "warn", priority = -2 } +keyword_idents = { level = "warn", priority = -3 } +let_underscore = { level = "warn", priority = -2 } nonstandard_style = { level = "warn", priority = -2 } +# refiing_impl_trait - Not needed for this project rust_2018_compatibility = { level = "warn", priority = -2 } rust_2018_idioms = { level = "warn", priority = -2 } rust_2021_compatibility = { level = "warn", priority = -2 } +rust_2024_compatibility = { level = "warn", priority = -2 } unused = { level = "warn", priority = -2 } unknown_lints = { level = "warn", priority = -1 } renamed_and_removed_lints = { level = "warn", priority = -1 } -absolute_paths_not_starting_with_crate = "warn" +# Allow certain configs in the check-cfg linting +unexpected_cfgs = { level = "warn", check-cfg = ["cfg(tarpaulin_include)"] } + +# absolute_paths_not_starting_with_crate - group rust_2018_compatibility +# box-pointers - used in project, and is safe to do so deprecated_in_future = "warn" -dead_code = "warn" -elided_lifetimes_in_paths = "warn" -explicit_outlives_requirements = "warn" +# elided_lifetimes_in_paths - group: rust_2018_idioms +# explicit_outlives_requirements - group: rust_2018_idioms ffi_unwind_calls = "warn" -keyword_idents = "warn" -let_underscore_drop = "warn" +# fuzzy_provenance_casts - unstable +# impl_trait_overcaptures - unstable +# keyword_idents_2018 - group: rust_2018_compatibility +# keyword_idents_2024 - group: rust_2024_compatibility +# let_underscore_drop - group: let_underscore +# lossy_provenance_casts - unstable macro_use_extern_crate = "warn" meta_variable_misuse = "warn" missing_abi = "warn" missing_copy_implementations = "warn" missing_debug_implementations = "warn" +# missing_docs - not requiring docs in this project +# multiple_supertrait_upcastable - unstable +# must_not_suspend - unstable non_ascii_idents = "warn" -noop_method_call = "warn" -pointer_structural_match = "warn" -rust_2021_incompatible_closure_captures = "warn" -rust_2021_incompatible_or_patterns = "warn" -rust_2021_prefixes_incompatible_syntax = "warn" -rust_2021_prelude_collisions = "warn" +# non_exhaustive_omitted_patterns - unstable +redundant_lifetimes = "warn" +# rust_2021_incompatible_closure_captures - group: rust_2021_compatibility +# rust_2021_incompatible_or_patterns - group: rust_2021_compatibility +# rust_2021_prefixes_incompatible_syntax - group: rust_2021_compatibility +# rust_2021_prelude_collisions - group: rust_2021_compatibility +# rust_2024_incompatible_pat - unstable single_use_lifetimes = "warn" trivial_casts = "warn" trivial_numeric_casts = "warn" +unit-bindings = "warn" +unnameable_types = "warn" unreachable_pub = "warn" unsafe_code = "warn" -unsafe_op_in_unsafe_fn = "warn" +# unsafe_op_in_unsafe_fn - group: rust_2024_compatibility +# unstable_features - deprecated unused_crate_dependencies = "warn" -unused_extern_crates = "warn" +# unused_extern_crates - group: unused, rust_2018_idioms unused_import_braces = "warn" unused_lifetimes = "warn" -unused_macro_rules = "warn" +# unused_macro_rules - group: unused unused_qualifications = "warn" unused_results = "warn" variant_size_differences = "warn" @@ -135,7 +153,9 @@ cargo = { level = "warn", priority = -2 } pedantic = { level = "warn", priority = -2 } restriction = { level = "warn", priority = -2 } +# Clippy restricts enabling restricted lints blanket_clippy_restriction_lints = { level = "allow", priority = 5 } + absolute_paths = "allow" as_conversions = "allow" arithmetic_side_effects = "allow" @@ -146,6 +166,7 @@ expect_used = "allow" float_arithmetic = "allow" implicit_return = "allow" indexing_slicing = "allow" +integer_division_remainder_used = "allow" map_err_ignore = "allow" min_ident_chars = "allow" missing_docs_in_private_items = "allow" @@ -4,6 +4,8 @@ use chrono::{TimeZone, Utc}; use rustc_version::{version_meta, Channel}; fn main() { + println!("cargo::rustc-check-cfg=cfg(allow_unknown_lints)"); + println!("cargo::rustc-check-cfg=cfg(include_nightly_lints)"); // allow unknown lints in nightly builds if let Ok(meta) = version_meta() { if meta.channel == Channel::Nightly { diff --git a/ignored-lints.txt b/ignored-lints.txt deleted file mode 100644 index 529b0e3..0000000 --- a/ignored-lints.txt +++ /dev/null @@ -1,31 +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 - -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/src/exit.rs b/src/exit.rs index 494924f..8a7570f 100644 --- a/src/exit.rs +++ b/src/exit.rs @@ -1,24 +1,24 @@ use crate::module::ExitStatus; #[derive(Debug, PartialEq, Eq)] -pub struct Exit { +pub(crate) struct Exit { message: Option<String>, status: ExitStatus, } impl Exit { - pub fn new(status: ExitStatus, message: &str) -> Self { + pub(crate) fn new(status: ExitStatus, message: &str) -> Self { Self { message: Some(String::from(message)), status, } } - pub const fn get_message(&self) -> &Option<String> { + pub(crate) const fn get_message(&self) -> &Option<String> { &self.message } - pub const fn get_status(&self) -> &ExitStatus { + pub(crate) const fn get_status(&self) -> &ExitStatus { &self.status } } diff --git a/src/main.rs b/src/main.rs index 962bbcd..93f7a06 100644 --- a/src/main.rs +++ b/src/main.rs @@ -60,7 +60,7 @@ use crate::{ }; #[must_use] -pub fn run(os_args: Vec<OsString>) -> Exit { +fn run(os_args: Vec<OsString>) -> Exit { match Args::try_from(os_args) { Err(err) => err, Ok(args) => { diff --git a/src/module/exit_status.rs b/src/module/exit_status.rs index 00a1107..f0b38e5 100644 --- a/src/module/exit_status.rs +++ b/src/module/exit_status.rs @@ -1,5 +1,5 @@ #[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum ExitStatus { +pub(crate) enum ExitStatus { None, Abort, ConfigError, @@ -11,7 +11,7 @@ pub enum ExitStatus { } impl ExitStatus { - pub const fn to_code(self) -> i32 { + pub(crate) const fn to_code(self) -> i32 { match self { Self::Abort => 5, Self::ConfigError => 1, |