Skip to content

Commit 2bf1010

Browse files
committed
Replace feature = "cargo-clippy"
`cfg(feature = "cargo-clippy")` has been [deprecated]. The correct way to achieve the same result is now `cfg(clippy)`. [deprecated]: rust-lang/rust-clippy#12292
1 parent 9a782e6 commit 2bf1010

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ All notable changes to this project will be documented in this file.
1313
`AsRef<str>`, since we use the parameters in format strings. This is very
1414
unlikely to break anything.
1515

16+
### Changes
17+
18+
* Switched [code to disable Clippy][disable_clippy] to use `cfg(clippy)` instead
19+
of `cfg(feature = "cargo-clippy")`. The [feature has been deprecated].
20+
21+
[disable_clippy]: https://docs.rs/matchgen/latest/matchgen/struct.TreeMatcher.html#method.disable_clippy
22+
[feature has been deprecated]: https://blog.rust-lang.org/2024/02/28/Clippy-deprecating-feature-cargo-clippy.html
23+
1624
## Release 0.2.0 (2023-05-26)
1725

1826
This release is primarily aimed at ensuring generated code passes lints.

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ impl TreeMatcher {
361361
///
362362
/// use bstr::ByteVec;
363363
/// pretty_assertions::assert_str_eq!(
364-
/// r#"#[cfg(not(feature = "cargo-clippy"))]
364+
/// r#"#[cfg(not(clippy))]
365365
/// #[must_use]
366366
/// fn match_bytes(slice: &[u8]) -> (Option<u64>, &[u8]) {
367367
/// match slice.first() {
@@ -370,7 +370,7 @@ impl TreeMatcher {
370370
/// }
371371
/// }
372372
///
373-
/// #[cfg(feature = "cargo-clippy")]
373+
/// #[cfg(clippy)]
374374
/// #[must_use]
375375
/// fn match_bytes(slice: &[u8]) -> (Option<u64>, &[u8]) {
376376
/// (None, slice)
@@ -385,14 +385,14 @@ impl TreeMatcher {
385385
/// This can return [`io::Error`] if there is a problem writing to `writer`.
386386
pub fn render<W: io::Write>(&self, writer: &mut W) -> io::Result<()> {
387387
if self.disable_clippy {
388-
writeln!(writer, "#[cfg(not(feature = \"cargo-clippy\"))]")?;
388+
writeln!(writer, "#[cfg(not(clippy))]")?;
389389
}
390390

391391
self.render_func(writer)?;
392392

393393
if self.disable_clippy {
394394
writeln!(writer)?;
395-
writeln!(writer, "#[cfg(feature = \"cargo-clippy\")]")?;
395+
writeln!(writer, "#[cfg(clippy)]")?;
396396
self.render_stub(writer)?;
397397
}
398398

0 commit comments

Comments
 (0)