From 2bf1010d0f1206bbc7533dfdd0b836b6a318a69a Mon Sep 17 00:00:00 2001 From: Daniel Parks Date: Wed, 28 Feb 2024 11:43:22 -0800 Subject: [PATCH] Replace `feature = "cargo-clippy"` `cfg(feature = "cargo-clippy")` has been [deprecated]. The correct way to achieve the same result is now `cfg(clippy)`. [deprecated]: https://github.com/rust-lang/rust-clippy/pull/12292 --- CHANGELOG.md | 8 ++++++++ src/lib.rs | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0912249..dd821ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,14 @@ All notable changes to this project will be documented in this file. `AsRef`, since we use the parameters in format strings. This is very unlikely to break anything. +### Changes + +* Switched [code to disable Clippy][disable_clippy] to use `cfg(clippy)` instead + of `cfg(feature = "cargo-clippy")`. The [feature has been deprecated]. + +[disable_clippy]: https://docs.rs/matchgen/latest/matchgen/struct.TreeMatcher.html#method.disable_clippy +[feature has been deprecated]: https://blog.rust-lang.org/2024/02/28/Clippy-deprecating-feature-cargo-clippy.html + ## Release 0.2.0 (2023-05-26) This release is primarily aimed at ensuring generated code passes lints. diff --git a/src/lib.rs b/src/lib.rs index c2baad0..66c272a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -361,7 +361,7 @@ impl TreeMatcher { /// /// use bstr::ByteVec; /// pretty_assertions::assert_str_eq!( - /// r#"#[cfg(not(feature = "cargo-clippy"))] + /// r#"#[cfg(not(clippy))] /// #[must_use] /// fn match_bytes(slice: &[u8]) -> (Option, &[u8]) { /// match slice.first() { @@ -370,7 +370,7 @@ impl TreeMatcher { /// } /// } /// - /// #[cfg(feature = "cargo-clippy")] + /// #[cfg(clippy)] /// #[must_use] /// fn match_bytes(slice: &[u8]) -> (Option, &[u8]) { /// (None, slice) @@ -385,14 +385,14 @@ impl TreeMatcher { /// This can return [`io::Error`] if there is a problem writing to `writer`. pub fn render(&self, writer: &mut W) -> io::Result<()> { if self.disable_clippy { - writeln!(writer, "#[cfg(not(feature = \"cargo-clippy\"))]")?; + writeln!(writer, "#[cfg(not(clippy))]")?; } self.render_func(writer)?; if self.disable_clippy { writeln!(writer)?; - writeln!(writer, "#[cfg(feature = \"cargo-clippy\")]")?; + writeln!(writer, "#[cfg(clippy)]")?; self.render_stub(writer)?; }