From 34c9a647795cda32a415c70c5458dffc87444a46 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Sun, 20 Oct 2024 15:27:02 +0100 Subject: [PATCH] Mute unreachable patterns/code warnings (#16012) # Objective Make compiler output more helpful when running `cargo check -p bevy_mesh`. Currently it contains a lot of unreachable patterns/code warnings due to features disabled by default. ## Solution Mute the warnings. ## Testing CI --- crates/bevy_image/src/image.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/bevy_image/src/image.rs b/crates/bevy_image/src/image.rs index 7d4c39e453a3e..abf504536e2e7 100644 --- a/crates/bevy_image/src/image.rs +++ b/crates/bevy_image/src/image.rs @@ -166,6 +166,7 @@ impl ImageFormat { } pub fn from_mime_type(mime_type: &str) -> Option { + #[allow(unreachable_code)] Some(match mime_type.to_ascii_lowercase().as_str() { // note: farbfeld does not have a MIME type "image/basis" | "image/x-basis" => feature_gate!("basis-universal", Basis), @@ -191,6 +192,7 @@ impl ImageFormat { } pub fn from_extension(extension: &str) -> Option { + #[allow(unreachable_code)] Some(match extension.to_ascii_lowercase().as_str() { "basis" => feature_gate!("basis-universal", Basis), "bmp" => feature_gate!("bmp", Bmp), @@ -213,6 +215,7 @@ impl ImageFormat { } pub fn as_image_crate_format(&self) -> Option { + #[allow(unreachable_code)] Some(match self { #[cfg(feature = "bmp")] ImageFormat::Bmp => image::ImageFormat::Bmp, @@ -253,6 +256,7 @@ impl ImageFormat { } pub fn from_image_crate_format(format: image::ImageFormat) -> Option { + #[allow(unreachable_code)] Some(match format { image::ImageFormat::Bmp => feature_gate!("bmp", Bmp), image::ImageFormat::Dds => feature_gate!("dds", Dds), @@ -895,6 +899,7 @@ impl Image { ImageFormat::Ktx2 => { ktx2_buffer_to_image(buffer, supported_compressed_formats, is_srgb)? } + #[allow(unreachable_patterns)] _ => { let image_crate_format = format .as_image_crate_format()