diff --git a/CHANGELOG.md b/CHANGELOG.md index fe5e3e7..c2b4ff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ This release has an [MSRV] of 1.74. ### Changed -... +- Breaking: Mark `Format` as `#[non_exhaustive]` ([#XXX][] by [@DJMcNab][]) ### Fixed diff --git a/Cargo.toml b/Cargo.toml index 3b12e5d..f07dfa8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,34 +78,38 @@ rust.missing_debug_implementations = "warn" rust.unused_qualifications = "warn" rust.single_use_lifetimes = "warn" -# clippy.exhaustive_enums = "warn" -# clippy.dbg_macro = "warn" -# clippy.match_same_arms = "warn" +clippy.dbg_macro = "warn" +clippy.match_same_arms = "warn" # clippy.cast_possible_truncation = "warn" -# clippy.missing_assert_message = "warn" -# clippy.return_self_not_must_use = "warn" -# clippy.wildcard_imports = "warn" -# rust.elided_lifetimes_in_paths = "warn" +clippy.missing_assert_message = "warn" +clippy.return_self_not_must_use = "warn" +clippy.wildcard_imports = "warn" +rust.elided_lifetimes_in_paths = "warn" # clippy.use_self = "warn" # Aspirational lints, not enabled for one reason or another -rust.missing_docs = "warn" # We have many as-yet undocumented items -rust.unreachable_pub = "warn" # Potentially controversial code style -rust.unnameable_types = "warn" # Requires lint_reasons rustc feature for exceptions -# clippy.todo = "warn" # We have a lot of "real" todos -# clippy.missing_errors_doc = "warn" # Can be quite noisy? -# clippy.missing_panics_doc = "warn" # Can be quite noisy? -# clippy.partial_pub_fields = "warn" # Potentially controversial code style -# clippy.shadow_unrelated = "warn" # Potentially controversial code style +rust.missing_docs = "warn" +rust.unreachable_pub = "warn" +rust.unnameable_types = "warn" +clippy.todo = "warn" +clippy.missing_errors_doc = "warn" +clippy.missing_panics_doc = "warn" +clippy.partial_pub_fields = "warn" +clippy.shadow_unrelated = "warn" # This catches duplicated dependencies in the tree, which we don't have much control over # We should use cargo deny for this, anyway -# clippy.cargo = "warn" +clippy.cargo = { level = "warn", priority = -1 } + +# Lints which we set in `lib.rs`, instead of at a package level. -# Lints which we still set in individual crates lib.rs # False positives with example targets - https://github.com/rust-lang/rust/issues/57274 # rust.unused_crate_dependencies = "warn" # Examples often do want to print # clippy.print_stdout = "warn" # Note that this is allowed in Masonry # clippy.print_stderr = "warn" # Note that this is allowed in Masonry + +# Explicit per-crate exceptions +# Should be manually checked occasionally. Most enums are correctly exhaustive, as this is a vocabulary crate. +# clippy.exhaustive_enums = "warn" diff --git a/src/blob.rs b/src/blob.rs index c82ce72..b6ff34c 100644 --- a/src/blob.rs +++ b/src/blob.rs @@ -44,7 +44,7 @@ where } impl fmt::Debug for Blob { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Blob") .field("id", &self.id) .finish_non_exhaustive() diff --git a/src/color.rs b/src/color.rs index 18aaa9c..9559f52 100644 --- a/src/color.rs +++ b/src/color.rs @@ -85,8 +85,7 @@ impl Color { #[allow(clippy::many_single_char_names)] #[allow(clippy::unreadable_literal)] #[must_use] - pub fn hlca(h: f64, l: f64, c: f64, a: f64) -> Color { - let alpha = a; + pub fn hlca(h: f64, l: f64, c: f64, alpha: f64) -> Color { // The reverse transformation from Lab to XYZ, see // https://en.wikipedia.org/wiki/CIELAB_color_space fn f_inv(t: f64) -> f64 { diff --git a/src/image.rs b/src/image.rs index b9100df..51468c1 100644 --- a/src/image.rs +++ b/src/image.rs @@ -10,6 +10,7 @@ use super::{Blob, Extend}; /// Defines the pixel format of an [image](Image). #[derive(Copy, Clone, PartialEq, Eq, Debug)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[non_exhaustive] pub enum Format { /// 32-bit RGBA with 8-bit channels. Rgba8,