Skip to content

Fix clippy warnings and doc(cfg) attributes#12

Open
leighmcculloch wants to merge 4 commits intomainfrom
fix-clippy
Open

Fix clippy warnings and doc(cfg) attributes#12
leighmcculloch wants to merge 4 commits intomainfrom
fix-clippy

Conversation

@leighmcculloch
Copy link
Copy Markdown
Member

@leighmcculloch leighmcculloch commented Apr 22, 2026

What

Replace #[cfg_attr(feature = "doc", doc(cfg(...)))] with #[cfg_attr(doc, doc(cfg(...)))] in src/escape.rs and src/unescape.rs. Add #![cfg_attr(doc, feature(doc_cfg))] to src/lib.rs to enable the nightly doc_cfg feature when building docs. Replace the let...else in Escape::next with the ? operator.

Why

feature = "doc" is not a defined Cargo feature, so the doc(cfg(feature = "alloc")) annotation never activated and rustdoc output omitted feature-gate hints on alloc-gated items. The let...else triggered clippy::question_mark.

Close #11

@leighmcculloch leighmcculloch requested a review from fnando April 22, 2026 04:32
@leighmcculloch leighmcculloch marked this pull request as ready for review April 22, 2026 04:32
Copilot AI review requested due to automatic review settings April 22, 2026 04:32
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0fbef63a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib.rs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Clippy warnings and fixes non-activating rustdoc feature-gating annotations by adjusting cfg_attr usage for doc(cfg(...)) and simplifying iterator code in Escape::next.

Changes:

  • Switch cfg_attr(feature = "doc", ...) to cfg_attr(doc, ...) for doc(cfg(feature = "alloc")) annotations.
  • Enable doc_cfg (nightly) when building docs via a crate-level cfg_attr.
  • Replace a let ... else with ? in Escape::next to satisfy clippy::question_mark.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/lib.rs Adds crate-level gating intended to enable nightly doc_cfg for doc builds.
src/escape.rs Updates doc(cfg(...)) activation condition and applies a small Clippy-driven simplification in Escape::next.
src/unescape.rs Updates doc(cfg(...)) activation condition for the alloc-gated API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib.rs Outdated
Comment thread src/escape.rs Outdated
Comment thread src/unescape.rs Outdated
Comment thread Makefile
doc:
cargo hack test --doc --all-features
cargo hack test --doc
RUSTDOCFLAGS="--cfg doc" cargo +nightly doc --all-features --open
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[picky] is the RUSTDOCFLAGS="--cfg doc" needed anymore?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clippy warnings on stable and non-activating doc(cfg) attribute

3 participants