Remove doc(cfg()) from expressions

warning: unused doc comment
       --> gstreamer-video/src/video_info.rs:655:37
        |
    655 |           #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
        |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    656 | /         {
    657 | |             VideoInfoBuilder {
    658 | |                 format,
    659 | |                 width,
    ...   |
    674 | |             }
    675 | |         }
        | |_________- rustdoc does not generate documentation for expressions

Also simplify some blocks into expressions which are allowed to have
attributes as well since Rust 1.43.
This commit is contained in:
Marijn Suijten 2020-11-19 11:08:50 +01:00
parent bd75778fcb
commit aeb1b70581
4 changed files with 14 additions and 38 deletions

View file

@ -761,7 +761,6 @@ where
klass.fixate_src_caps = Some(aggregator_fixate_src_caps::<T>); klass.fixate_src_caps = Some(aggregator_fixate_src_caps::<T>);
klass.negotiated_src_caps = Some(aggregator_negotiated_src_caps::<T>); klass.negotiated_src_caps = Some(aggregator_negotiated_src_caps::<T>);
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
{ {
klass.sink_event_pre_queue = Some(aggregator_sink_event_pre_queue::<T>); klass.sink_event_pre_queue = Some(aggregator_sink_event_pre_queue::<T>);
klass.sink_query_pre_queue = Some(aggregator_sink_query_pre_queue::<T>); klass.sink_query_pre_queue = Some(aggregator_sink_query_pre_queue::<T>);

View file

@ -346,10 +346,7 @@ impl fmt::Debug for VideoInfo {
.field("multiview_flags", &self.multiview_flags()); .field("multiview_flags", &self.multiview_flags());
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))] b.field("field_order", &self.field_order());
{
b.field("field_order", &self.field_order());
};
b.finish() b.finish()
} }
@ -520,12 +517,9 @@ impl<'a> VideoInfoBuilder<'a> {
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))] if let Some(field_order) = self.field_order {
{ let ptr = &mut info.ABI._gst_reserved as *mut _ as *mut i32;
if let Some(field_order) = self.field_order { ptr::write(ptr.offset(2), field_order.to_glib());
let ptr = &mut info.ABI._gst_reserved as *mut _ as *mut i32;
ptr::write(ptr.offset(2), field_order.to_glib());
}
} }
Ok(VideoInfo(info)) Ok(VideoInfo(info))
@ -631,7 +625,6 @@ impl VideoInfo {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
#[cfg(not(any(feature = "v1_12", feature = "dox")))] #[cfg(not(any(feature = "v1_12", feature = "dox")))]
#[cfg_attr(feature = "dox", doc(cfg(not(feature = "v1_12"))))]
{ {
VideoInfoBuilder { VideoInfoBuilder {
format, format,
@ -652,7 +645,6 @@ impl VideoInfo {
} }
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
{ {
VideoInfoBuilder { VideoInfoBuilder {
format, format,

View file

@ -1327,11 +1327,8 @@ impl<'a> StreamStartBuilder<'a> {
} }
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] if let Some(ref stream) = s.stream {
{ gst_sys::gst_event_set_stream(ev, stream.to_glib_none().0);
if let Some(ref stream) = s.stream {
gst_sys::gst_event_set_stream(ev, stream.to_glib_none().0);
}
} }
ev ev
@ -1675,14 +1672,8 @@ impl<'a> SeekBuilder<'a> {
); );
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] if let Some(trickmode_interval) = s.trickmode_interval {
{ gst_sys::gst_event_set_seek_trickmode_interval(ev, trickmode_interval.to_glib());
if let Some(trickmode_interval) = s.trickmode_interval {
gst_sys::gst_event_set_seek_trickmode_interval(
ev,
trickmode_interval.to_glib(),
);
}
} }
ev ev

View file

@ -1626,17 +1626,14 @@ macro_rules! message_builder_generic_impl {
} }
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] if !self.builder.other_fields.is_empty() {
{ let structure = gst_sys::gst_message_writable_structure(msg);
if !self.builder.other_fields.is_empty() {
let structure = gst_sys::gst_message_writable_structure(msg);
if !structure.is_null() { if !structure.is_null() {
let structure = StructureRef::from_glib_borrow_mut(structure as *mut _); let structure = StructureRef::from_glib_borrow_mut(structure as *mut _);
for (k, v) in self.builder.other_fields { for (k, v) in self.builder.other_fields {
structure.set_value(k, v.to_send_value()); structure.set_value(k, v.to_send_value());
}
} }
} }
} }
@ -1708,7 +1705,6 @@ impl<'a, T: MessageErrorDomain> ErrorBuilder<'a, T> {
message_builder_generic_impl!(|s: &mut Self, src| { message_builder_generic_impl!(|s: &mut Self, src| {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
{ {
let details = match s.details.take() { let details = match s.details.take() {
None => ptr::null_mut(), None => ptr::null_mut(),
@ -1776,7 +1772,6 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> {
message_builder_generic_impl!(|s: &mut Self, src| { message_builder_generic_impl!(|s: &mut Self, src| {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
{ {
let details = match s.details.take() { let details = match s.details.take() {
None => ptr::null_mut(), None => ptr::null_mut(),
@ -1844,7 +1839,6 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> {
message_builder_generic_impl!(|s: &mut Self, src| { message_builder_generic_impl!(|s: &mut Self, src| {
#[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg(any(feature = "v1_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
{ {
let details = match s.details.take() { let details = match s.details.take() {
None => ptr::null_mut(), None => ptr::null_mut(),