-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codegen/enum: Do not generate doc(cfg) on match arms #994
Conversation
warning: unused doc comment --> gstreamer/src/auto/enums.rs:761:41 | 761 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 762 | 66817 => EventType::InstantRateSyncTime, | --------------------------------------- rustdoc does not generate documentation for match arms Fixes: c63d1fa ("Generate doc cfg attributes for more beautiful docs")
Should this be |
Solves warnings of the following kind in gtk-rs: warning: unused doc comment --> gtk/src/auto/window.rs:309:37 | 309 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 310 | / { 311 | | if let Some(ref focus_on_click) = self.focus_on_click { 312 | | properties.push(("focus-on-click", focus_on_click)); 313 | | } 314 | | } | |_________- rustdoc does not generate documentation for expressions Also remove the surrounding expression block and convoluted indentation logic: if {} is also an expression block that can take attributes.
Switching attributes to work directly on ifs was worth a shot, but that apparently only landed on 1.43 whereas gtk-rs's MSRV is https://github.com/gtk-rs/gtk-rs/runs/1420232906. If we can't bump this on the short term I'll push the long way around, which is still in local |
We're updating to 1.48 today or tomorrow, so feel free to add back that change if it makes anything nicer :) |
Awesome! The change is still here, I held off removing it until receiving this reply 😁. Wasn't expecting an immediate jump from 1.40 all the way to 1.48 though, but that definitely makes everything a lot nicer. |
Then let's get this in here now, and regenerate everything later/tomorrow as part of moving to 1.48. |
This and earlier PRs enable generation doc(cfg()) attributes on symbols to show cfg requirements directly in the documentation.
Simplify some duplicate code around cfg and version handling, and fix the following warnings when compiling with the
dox
feature:Fixes: c63d1fa ("Generate doc cfg attributes for more beautiful docs")