Move deny lints to Cargo workspace config

To reduce duplication and make it clearer which denials are then overridden for each crate.
This commit is contained in:
Oliver Hamlet
2025-07-22 19:56:21 +01:00
parent a7f6285a6c
commit fee6504fa8
15 changed files with 147 additions and 482 deletions
+3
View File
@@ -15,3 +15,6 @@ cxx-build = "1.0"
[lib]
crate-type = ["staticlib"]
[lints]
workspace = true
+8 -95
View File
@@ -1,102 +1,14 @@
// Deny some rustc lints that are allow-by-default.
#![deny(
ambiguous_negative_literals,
impl_trait_overcaptures,
let_underscore_drop,
missing_copy_implementations,
missing_debug_implementations,
non_ascii_idents,
redundant_imports,
redundant_lifetimes,
trivial_casts,
trivial_numeric_casts,
unit_bindings
// Allow some lints that are denied at the workspace level.
#![allow(
unreachable_pub,
unsafe_code,
clippy::must_use_candidate,
clippy::missing_errors_doc
)]
#![deny(clippy::pedantic)]
// Allow a few clippy pedantic lints.
#![allow(clippy::must_use_candidate)]
#![allow(clippy::missing_errors_doc)]
#![allow(
clippy::unnecessary_box_returns,
reason = "CXX requires many returns to be boxed"
)]
// Selectively deny clippy restriction lints.
#![deny(
clippy::as_conversions,
clippy::as_underscore,
clippy::assertions_on_result_states,
clippy::big_endian_bytes,
clippy::cfg_not_test,
clippy::clone_on_ref_ptr,
clippy::create_dir,
clippy::dbg_macro,
clippy::decimal_literal_representation,
clippy::default_numeric_fallback,
clippy::doc_include_without_cfg,
clippy::empty_drop,
clippy::error_impl_error,
clippy::exit,
clippy::exhaustive_enums,
clippy::expect_used,
clippy::filetype_is_file,
clippy::float_cmp_const,
clippy::fn_to_numeric_cast_any,
clippy::get_unwrap,
clippy::host_endian_bytes,
clippy::if_then_some_else_none,
clippy::indexing_slicing,
clippy::infinite_loop,
clippy::integer_division,
clippy::integer_division_remainder_used,
clippy::iter_over_hash_type,
clippy::let_underscore_must_use,
clippy::lossy_float_literal,
clippy::map_err_ignore,
clippy::map_with_unused_argument_over_ranges,
clippy::mem_forget,
clippy::missing_assert_message,
clippy::missing_asserts_for_indexing,
clippy::mixed_read_write_in_expression,
clippy::multiple_inherent_impl,
clippy::multiple_unsafe_ops_per_block,
clippy::mutex_atomic,
clippy::mutex_integer,
clippy::needless_raw_strings,
clippy::non_ascii_literal,
clippy::non_zero_suggestions,
clippy::panic,
clippy::panic_in_result_fn,
clippy::partial_pub_fields,
clippy::pathbuf_init_then_push,
clippy::precedence_bits,
clippy::print_stderr,
clippy::print_stdout,
clippy::rc_buffer,
clippy::rc_mutex,
clippy::redundant_type_annotations,
clippy::ref_patterns,
clippy::rest_pat_in_fully_bound_structs,
clippy::str_to_string,
clippy::string_lit_chars_any,
clippy::string_slice,
clippy::string_to_string,
clippy::suspicious_xor_used_as_pow,
clippy::tests_outside_test_module,
clippy::todo,
clippy::try_err,
clippy::undocumented_unsafe_blocks,
clippy::unimplemented,
clippy::unnecessary_safety_comment,
clippy::unneeded_field_pattern,
clippy::unreachable,
clippy::unused_result_ok,
clippy::unwrap_in_result,
clippy::unwrap_used,
clippy::use_debug,
clippy::verbose_file_reads,
clippy::wildcard_enum_match_arm
)]
mod database;
mod error;
mod game;
@@ -203,9 +115,10 @@ impl TryFrom<ffi::LogLevel> for libloot::LogLevel {
#[allow(
let_underscore_drop,
missing_debug_implementations,
clippy::allow_attributes,
clippy::multiple_unsafe_ops_per_block,
clippy::needless_lifetimes,
reason = "Required by CXX"
reason = "Required by CXX. clippy::allow_attributes is because CXX doesn't support #[expect(...)]"
)]
#[cxx::bridge(namespace = "loot::rust")]
mod ffi {