Skip to content

Commit

Permalink
Move linting config to Cargo.toml and only warn
Browse files Browse the repository at this point in the history
This reworks the rustc, Clippy, and rustdoc linting configuration to the
Cargo.toml file, and converts all denied lints to be warnings.
  • Loading branch information
MitMaro committed Jun 30, 2024
1 parent 3fef42a commit d0f12cc
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 60 deletions.
88 changes: 88 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,91 @@ edition = "2018"

[lib]
name = "captur"

[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 }

# 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 - no reason to disallow this in project
deprecated_in_future = "warn"
# elided_lifetimes_in_paths - group: rust_2018_idioms
# explicit_outlives_requirements - group: rust_2018_idioms
ffi_unwind_calls = "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"
# 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 - group: rust_2024_compatibility
# unstable_features - deprecated
unused_crate_dependencies = "warn"
# unused_extern_crates - group: unused, rust_2018_idioms
unused_import_braces = "warn"
unused_lifetimes = "warn"
# unused_macro_rules - group: unused
unused_qualifications = "warn"
unused_results = "warn"
variant_size_differences = "warn"

[lints.clippy]
all = { level = "warn", priority = -2 }
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 }

implicit_return = "allow"
min_ident_chars = "allow"
missing_docs_in_private_items = "allow"
redundant_pub_crate = "allow"
tabs_in_doc_comments = "allow"

[lints.rustdoc]
bare_urls = "warn"
broken_intra_doc_links = "warn"
invalid_codeblock_attributes = "warn"
invalid_html_tags = "warn"
missing_crate_level_docs = "allow"
private_doc_tests = "warn"
private_intra_doc_links = "warn"
60 changes: 0 additions & 60 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,63 +1,3 @@
#![deny(
future_incompatible,
nonstandard_style,
rust_2018_compatibility,
rust_2018_idioms,
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,
keyword_idents,
macro_use_extern_crate,
meta_variable_misuse,
missing_abi,
missing_copy_implementations,
missing_debug_implementations,
missing_docs,
non_ascii_idents,
noop_method_call,
or_patterns_back_compat,
pointer_structural_match,
semicolon_in_expressions_from_macros,
single_use_lifetimes,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unsafe_code,
unsafe_op_in_unsafe_fn,
unstable_features,
unused_crate_dependencies,
unused_extern_crates,
unused_import_braces,
unused_lifetimes,
unused_qualifications,
unused_results,
variant_size_differences
)]
// enable all of Clippy's lints
#![deny(clippy::all, clippy::cargo, clippy::nursery, clippy::pedantic, clippy::restriction)]
#![allow(
clippy::blanket_clippy_restriction_lints,
clippy::implicit_return,
clippy::missing_docs_in_private_items,
clippy::redundant_pub_crate,
clippy::tabs_in_doc_comments
)]
#![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
)]

//! # Captur
//!
//! Starting in Rust 2021, Rust will no longer capture whole structs and instead will only capture a
Expand Down

0 comments on commit d0f12cc

Please sign in to comment.