Fix clippy warnings and doc(cfg) attributes#12
Conversation
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
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", ...)tocfg_attr(doc, ...)fordoc(cfg(feature = "alloc"))annotations. - Enable
doc_cfg(nightly) when building docs via a crate-levelcfg_attr. - Replace a
let ... elsewith?inEscape::nextto satisfyclippy::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.
| doc: | ||
| cargo hack test --doc --all-features | ||
| cargo hack test --doc | ||
| RUSTDOCFLAGS="--cfg doc" cargo +nightly doc --all-features --open |
There was a problem hiding this comment.
[picky] is the RUSTDOCFLAGS="--cfg doc" needed anymore?
What
Replace
#[cfg_attr(feature = "doc", doc(cfg(...)))]with#[cfg_attr(doc, doc(cfg(...)))]insrc/escape.rsandsrc/unescape.rs. Add#![cfg_attr(doc, feature(doc_cfg))]tosrc/lib.rsto enable the nightlydoc_cfgfeature when building docs. Replace thelet...elseinEscape::nextwith the?operator.Why
feature = "doc"is not a defined Cargo feature, so thedoc(cfg(feature = "alloc"))annotation never activated and rustdoc output omitted feature-gate hints onalloc-gated items. Thelet...elsetriggeredclippy::question_mark.Close #11