Skip to content

Commit

Permalink
Merge pull request #41 from danielparks/cfg-clippy
Browse files Browse the repository at this point in the history
Replace `feature = "cargo-clippy"`
  • Loading branch information
danielparks authored Jun 18, 2024
2 parents 9a782e6 + 2bf1010 commit 806789c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ All notable changes to this project will be documented in this file.
`AsRef<str>`, 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.
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64>, &[u8]) {
/// match slice.first() {
Expand All @@ -370,7 +370,7 @@ impl TreeMatcher {
/// }
/// }
///
/// #[cfg(feature = "cargo-clippy")]
/// #[cfg(clippy)]
/// #[must_use]
/// fn match_bytes(slice: &[u8]) -> (Option<u64>, &[u8]) {
/// (None, slice)
Expand All @@ -385,14 +385,14 @@ impl TreeMatcher {
/// This can return [`io::Error`] if there is a problem writing to `writer`.
pub fn render<W: io::Write>(&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)?;
}

Expand Down

0 comments on commit 806789c

Please sign in to comment.