From aeb1b70581c68ba9a33ef8c99d82174c3fd1275c Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Thu, 19 Nov 2020 11:08:50 +0100 Subject: [PATCH] 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. --- gstreamer-base/src/subclass/aggregator.rs | 1 - gstreamer-video/src/video_info.rs | 16 ++++------------ gstreamer/src/event.rs | 17 ++++------------- gstreamer/src/message.rs | 18 ++++++------------ 4 files changed, 14 insertions(+), 38 deletions(-) diff --git a/gstreamer-base/src/subclass/aggregator.rs b/gstreamer-base/src/subclass/aggregator.rs index a90f9fc4a..f4dccb9da 100644 --- a/gstreamer-base/src/subclass/aggregator.rs +++ b/gstreamer-base/src/subclass/aggregator.rs @@ -761,7 +761,6 @@ where klass.fixate_src_caps = Some(aggregator_fixate_src_caps::); klass.negotiated_src_caps = Some(aggregator_negotiated_src_caps::); #[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::); klass.sink_query_pre_queue = Some(aggregator_sink_query_pre_queue::); diff --git a/gstreamer-video/src/video_info.rs b/gstreamer-video/src/video_info.rs index 41fe1c43c..11bacd432 100644 --- a/gstreamer-video/src/video_info.rs +++ b/gstreamer-video/src/video_info.rs @@ -346,10 +346,7 @@ impl fmt::Debug for VideoInfo { .field("multiview_flags", &self.multiview_flags()); #[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() } @@ -520,12 +517,9 @@ impl<'a> VideoInfoBuilder<'a> { } #[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; - ptr::write(ptr.offset(2), field_order.to_glib()); - } + if let Some(field_order) = self.field_order { + let ptr = &mut info.ABI._gst_reserved as *mut _ as *mut i32; + ptr::write(ptr.offset(2), field_order.to_glib()); } Ok(VideoInfo(info)) @@ -631,7 +625,6 @@ impl VideoInfo { assert_initialized_main_thread!(); #[cfg(not(any(feature = "v1_12", feature = "dox")))] - #[cfg_attr(feature = "dox", doc(cfg(not(feature = "v1_12"))))] { VideoInfoBuilder { format, @@ -652,7 +645,6 @@ impl VideoInfo { } } #[cfg(any(feature = "v1_12", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))] { VideoInfoBuilder { format, diff --git a/gstreamer/src/event.rs b/gstreamer/src/event.rs index aee910adf..4b800ba15 100644 --- a/gstreamer/src/event.rs +++ b/gstreamer/src/event.rs @@ -1327,11 +1327,8 @@ impl<'a> StreamStartBuilder<'a> { } #[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 @@ -1675,14 +1672,8 @@ impl<'a> SeekBuilder<'a> { ); #[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 diff --git a/gstreamer/src/message.rs b/gstreamer/src/message.rs index 7e836cecf..1d677cc65 100644 --- a/gstreamer/src/message.rs +++ b/gstreamer/src/message.rs @@ -1626,17 +1626,14 @@ macro_rules! message_builder_generic_impl { } #[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() { - let structure = StructureRef::from_glib_borrow_mut(structure as *mut _); + if !structure.is_null() { + let structure = StructureRef::from_glib_borrow_mut(structure as *mut _); - for (k, v) in self.builder.other_fields { - structure.set_value(k, v.to_send_value()); - } + for (k, v) in self.builder.other_fields { + 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| { #[cfg(any(feature = "v1_10", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] { let details = match s.details.take() { None => ptr::null_mut(), @@ -1776,7 +1772,6 @@ impl<'a, T: MessageErrorDomain> WarningBuilder<'a, T> { message_builder_generic_impl!(|s: &mut Self, src| { #[cfg(any(feature = "v1_10", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] { let details = match s.details.take() { None => ptr::null_mut(), @@ -1844,7 +1839,6 @@ impl<'a, T: MessageErrorDomain> InfoBuilder<'a, T> { message_builder_generic_impl!(|s: &mut Self, src| { #[cfg(any(feature = "v1_10", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] { let details = match s.details.take() { None => ptr::null_mut(),