Skip to content

gstreamer: Move attributes on macro-calls like `cfg_if` inside the macro

Marijn Suijten requested to merge MarijnS95/gstreamer-rs:attr-on-macro into master

Attributes don't do anything when applied to macro invocations:

warning: unused attribute `doc`
   --> gstreamer/src/lib.rs:146:29
    |
146 | #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(unused_attributes)]` on by default
note: the built-in attribute `doc` will be ignored, since it's applied to the macro invocation `cfg_if::cfg_if`
   --> gstreamer/src/lib.rs:147:1
    |
147 | cfg_if::cfg_if! {
    | ^^^^^^^^^^^^^^

And, on line 294-295:

warning: unused attribute `doc`
   --> gstreamer/src/lib.rs:294:33
    |
294 |     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: the built-in attribute `doc` will be ignored, since it's applied to the macro invocation `cfg_if::cfg_if`
   --> gstreamer/src/lib.rs:295:5
    |
295 |     cfg_if::cfg_if! {
    |     ^^^^^^^^^^^^^^

Fortunately these two cfg_if's for the Unix and Windows bus already apply unnecessary trickery that duplicates the mods and uses in order to get documenation for both no matter the target platform; we can capitalize on that by removing the cfg_if altogether and instead applying the cfg and doc(cfg()) attributes directly.

Merge request reports