From 83160916557dd6862f9d4c909713f3dc6d4fcab9 Mon Sep 17 00:00:00 2001 From: pentamassiv Date: Sat, 5 Aug 2023 15:05:38 +0200 Subject: [PATCH 1/2] Untangle docsrs attribute from features --- gdk4-wayland/src/lib.rs | 6 +++--- gdk4-wayland/src/wayland_device.rs | 16 ++++++++-------- gdk4-wayland/src/wayland_display.rs | 14 +++++++------- gdk4-wayland/src/wayland_monitor.rs | 6 +++--- gdk4-wayland/src/wayland_seat.rs | 6 +++--- gdk4-wayland/src/wayland_surface.rs | 6 +++--- gdk4-win32/src/lib.rs | 2 +- gdk4-win32/src/win32_display.rs | 4 ++-- gdk4-x11/src/functions.rs | 2 +- gdk4-x11/src/lib.rs | 4 ++-- gdk4-x11/src/x11_display.rs | 18 +++++++++--------- gdk4-x11/src/x11_monitor.rs | 2 +- gdk4-x11/src/x11_screen.rs | 4 ++-- gdk4-x11/src/x11_surface.rs | 2 +- gdk4/src/content_formats.rs | 2 +- gdk4/src/drag_surface.rs | 2 +- gdk4/src/lib.rs | 10 +++++----- gdk4/src/prelude.rs | 2 +- gsk4/src/lib.rs | 8 ++++---- gsk4/src/render_node.rs | 8 ++++---- gsk4/src/transform.rs | 2 +- gtk4/src/expression_watch.rs | 2 +- gtk4/src/lib.rs | 4 ++-- gtk4/src/subclass/check_button.rs | 12 ++++++++---- gtk4/src/subclass/combo_box.rs | 12 ++++++++---- gtk4/src/subclass/im_context.rs | 12 ++++++++---- gtk4/src/subclass/mod.rs | 17 +++++++++-------- gtk4/src/subclass/widget.rs | 4 ++-- 28 files changed, 101 insertions(+), 88 deletions(-) diff --git a/gdk4-wayland/src/lib.rs b/gdk4-wayland/src/lib.rs index 07d8cb5fb1b2..a604c196b521 100644 --- a/gdk4-wayland/src/lib.rs +++ b/gdk4-wayland/src/lib.rs @@ -7,15 +7,15 @@ pub use ffi; pub use gdk; pub use gio; pub use glib; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub use wayland_client; -#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))] +#[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] pub use khronos_egl; -#[cfg(any(all(feature = "v4_4", feature = "xkb_crate"), docsrs))] +#[cfg(all(feature = "v4_4", feature = "xkb_crate"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "xkb_crate"))))] pub use xkb; diff --git a/gdk4-wayland/src/wayland_device.rs b/gdk4-wayland/src/wayland_device.rs index 338ae6636ea2..907e0749a1be 100644 --- a/gdk4-wayland/src/wayland_device.rs +++ b/gdk4-wayland/src/wayland_device.rs @@ -1,17 +1,17 @@ // Take a look at the license at the top of the repository in the LICENSE file. -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use crate::prelude::*; use crate::WaylandDevice; -#[cfg(any(feature = "wayland_crate", docsrs, feature = "xkb_crate"))] +#[cfg(any(feature = "wayland_crate", feature = "xkb_crate"))] #[cfg_attr( docsrs, doc(cfg(any(feature = "wayland_crate", feature = "xkb_crate"))) )] use glib::translate::*; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use wayland_client::{ backend::ObjectId, @@ -19,14 +19,14 @@ use wayland_client::{ Proxy, }; -#[cfg(any(all(feature = "v4_4", feature = "xkb_crate"), docsrs))] +#[cfg(all(feature = "v4_4", feature = "xkb_crate"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "xkb_crate"))))] use xkb::Keymap; impl WaylandDevice { #[doc(alias = "gdk_wayland_device_get_wl_keyboard")] #[doc(alias = "get_wl_keyboard")] - #[cfg(any(feature = "wayland_crate", docsrs))] + #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_keyboard(&self) -> Option { let display = self.display().downcast::().unwrap(); @@ -46,7 +46,7 @@ impl WaylandDevice { #[doc(alias = "gdk_wayland_device_get_wl_pointer")] #[doc(alias = "get_wl_pointer")] - #[cfg(any(feature = "wayland_crate", docsrs))] + #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_pointer(&self) -> Option { let display = self.display().downcast::().unwrap(); @@ -65,7 +65,7 @@ impl WaylandDevice { #[doc(alias = "gdk_wayland_device_get_wl_seat")] #[doc(alias = "get_wl_seat")] - #[cfg(any(feature = "wayland_crate", docsrs))] + #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_seat(&self) -> Option { let display = self.display().downcast::().unwrap(); @@ -82,7 +82,7 @@ impl WaylandDevice { } } - #[cfg(any(all(feature = "v4_4", feature = "xkb_crate"), docsrs))] + #[cfg(all(feature = "v4_4", feature = "xkb_crate"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "xkb_crate"))))] #[doc(alias = "gdk_wayland_device_get_xkb_keymap")] #[doc(alias = "get_xkb_keymap")] diff --git a/gdk4-wayland/src/wayland_display.rs b/gdk4-wayland/src/wayland_display.rs index feb2573d5a57..caa6f94a1550 100644 --- a/gdk4-wayland/src/wayland_display.rs +++ b/gdk4-wayland/src/wayland_display.rs @@ -1,15 +1,15 @@ // Take a look at the license at the top of the repository in the LICENSE file. use crate::WaylandDisplay; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use glib::{once_cell::sync::Lazy, prelude::*, translate::*, Quark}; -#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))] +#[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] use khronos_egl as egl; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use wayland_client::{ backend::ObjectId, @@ -17,12 +17,12 @@ use wayland_client::{ Proxy, }; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] static WAYLAND_DISPLAY_CONNECTION_QUARK: Lazy = Lazy::new(|| Quark::from_str("gtk-rs-wayland-display-connection-quark")); impl WaylandDisplay { - #[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))] + #[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] #[doc(alias = "gdk_wayland_display_get_egl_display")] #[doc(alias = "get_egl_display")] @@ -39,7 +39,7 @@ impl WaylandDisplay { #[doc(alias = "gdk_wayland_display_get_wl_compositor")] #[doc(alias = "get_wl_compositor")] - #[cfg(any(feature = "wayland_crate", docsrs))] + #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_compositor(&self) -> Option { unsafe { @@ -58,7 +58,7 @@ impl WaylandDisplay { #[doc(alias = "gdk_wayland_display_get_wl_display")] #[doc(alias = "get_wl_display")] - #[cfg(any(feature = "wayland_crate", docsrs))] + #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_display(&self) -> Option { unsafe { diff --git a/gdk4-wayland/src/wayland_monitor.rs b/gdk4-wayland/src/wayland_monitor.rs index f137294ab662..bcaf47584720 100644 --- a/gdk4-wayland/src/wayland_monitor.rs +++ b/gdk4-wayland/src/wayland_monitor.rs @@ -1,18 +1,18 @@ // Take a look at the license at the top of the repository in the LICENSE file. use crate::WaylandMonitor; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use {crate::prelude::*, glib::translate::*}; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use wayland_client::{backend::ObjectId, protocol::wl_output::WlOutput, Proxy}; impl WaylandMonitor { #[doc(alias = "gdk_wayland_monitor_get_wl_output")] #[doc(alias = "get_wl_output")] - #[cfg(any(feature = "wayland_crate", docsrs))] + #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_output(&self) -> Option { let display = self.display().downcast::().unwrap(); diff --git a/gdk4-wayland/src/wayland_seat.rs b/gdk4-wayland/src/wayland_seat.rs index ebd06fee337f..cf66b6811507 100644 --- a/gdk4-wayland/src/wayland_seat.rs +++ b/gdk4-wayland/src/wayland_seat.rs @@ -1,18 +1,18 @@ // Take a look at the license at the top of the repository in the LICENSE file. use crate::WaylandSeat; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use {crate::prelude::*, glib::translate::*}; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use wayland_client::{backend::ObjectId, protocol::wl_seat::WlSeat, Proxy}; impl WaylandSeat { #[doc(alias = "gdk_wayland_seat_get_wl_seat")] #[doc(alias = "get_wl_seat")] - #[cfg(any(feature = "wayland_crate", docsrs))] + #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] pub fn wl_seat(&self) -> Option { let display = self.display().downcast::().unwrap(); diff --git a/gdk4-wayland/src/wayland_surface.rs b/gdk4-wayland/src/wayland_surface.rs index d835cd1ed535..b4938bba0abb 100644 --- a/gdk4-wayland/src/wayland_surface.rs +++ b/gdk4-wayland/src/wayland_surface.rs @@ -1,11 +1,11 @@ // Take a look at the license at the top of the repository in the LICENSE file. use crate::{prelude::*, WaylandSurface}; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use glib::translate::*; -#[cfg(any(feature = "wayland_crate", docsrs))] +#[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] use wayland_client::{backend::ObjectId, protocol::wl_surface::WlSurface, Proxy}; @@ -19,7 +19,7 @@ mod sealed { pub trait WaylandSurfaceExtManual: sealed::Sealed + IsA + 'static { #[doc(alias = "gdk_wayland_surface_get_wl_surface")] #[doc(alias = "get_wl_surface")] - #[cfg(any(feature = "wayland_crate", docsrs))] + #[cfg(feature = "wayland_crate")] #[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))] fn wl_surface(&self) -> Option { let display = self diff --git a/gdk4-win32/src/lib.rs b/gdk4-win32/src/lib.rs index a5cb224dcc99..f72a14093ebd 100644 --- a/gdk4-win32/src/lib.rs +++ b/gdk4-win32/src/lib.rs @@ -7,7 +7,7 @@ pub use ffi; pub use gdk; pub use gio; pub use glib; -#[cfg(any(feature = "win32", docsrs))] +#[cfg(feature = "win32")] #[cfg_attr(docsrs, doc(cfg(feature = "win32")))] pub use windows; diff --git a/gdk4-win32/src/win32_display.rs b/gdk4-win32/src/win32_display.rs index b3bf9b5c2b6b..56e038de7221 100644 --- a/gdk4-win32/src/win32_display.rs +++ b/gdk4-win32/src/win32_display.rs @@ -3,12 +3,12 @@ use crate::{Win32Display, Win32MessageFilterReturn, MSG}; use glib::translate::*; -#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))] +#[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] use khronos_egl as egl; impl Win32Display { - #[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))] + #[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] #[doc(alias = "gdk_win32_display_get_egl_display")] #[doc(alias = "get_egl_display")] diff --git a/gdk4-x11/src/functions.rs b/gdk4-x11/src/functions.rs index 1b607b3fbd85..fc4c5a6a2815 100644 --- a/gdk4-x11/src/functions.rs +++ b/gdk4-x11/src/functions.rs @@ -5,7 +5,7 @@ use glib::{translate::*, IntoGStr}; #[cfg(not(feature = "xlib"))] use crate::XAtom; -#[cfg(any(feature = "xlib", docsrs))] +#[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] use x11::xlib::Atom as XAtom; diff --git a/gdk4-x11/src/lib.rs b/gdk4-x11/src/lib.rs index e79624dfa5d7..5ef68a54d799 100644 --- a/gdk4-x11/src/lib.rs +++ b/gdk4-x11/src/lib.rs @@ -7,11 +7,11 @@ pub use ffi; pub use gdk; pub use gio; pub use glib; -#[cfg(any(feature = "xlib", docsrs))] +#[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] pub use x11; -#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))] +#[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] pub use khronos_egl; #[macro_use] diff --git a/gdk4-x11/src/x11_display.rs b/gdk4-x11/src/x11_display.rs index b0718acd4d0b..23925e5cf8d7 100644 --- a/gdk4-x11/src/x11_display.rs +++ b/gdk4-x11/src/x11_display.rs @@ -1,28 +1,28 @@ // Take a look at the license at the top of the repository in the LICENSE file. use crate::{prelude::*, X11Display}; -#[cfg(any(feature = "xlib", docsrs))] +#[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] use glib::signal::{connect_raw, SignalHandlerId}; -#[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))] +#[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] use khronos_egl as egl; -#[cfg(any(feature = "xlib", docsrs))] +#[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] use std::{boxed::Box as Box_, mem::transmute}; -#[cfg(any(feature = "xlib", docsrs))] +#[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] use x11::xlib; #[cfg(not(feature = "xlib"))] use crate::{XCursor, XWindow}; use glib::{translate::*, IntoGStr}; -#[cfg(any(feature = "xlib", docsrs))] +#[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] use x11::xlib::{Cursor as XCursor, Window as XWindow}; impl X11Display { - #[cfg(any(all(feature = "v4_4", feature = "egl"), docsrs))] + #[cfg(all(feature = "v4_4", feature = "egl"))] #[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))] #[doc(alias = "gdk_x11_display_get_egl_display")] #[doc(alias = "get_egl_display")] @@ -49,7 +49,7 @@ impl X11Display { unsafe { ffi::gdk_x11_display_get_xrootwindow(self.to_glib_none().0) } } - #[cfg(any(feature = "xlib", docsrs))] + #[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] #[doc(alias = "gdk_x11_display_get_xdisplay")] #[doc(alias = "get_xdisplay")] @@ -57,7 +57,7 @@ impl X11Display { ffi::gdk_x11_display_get_xdisplay(self.to_glib_none().0) as *mut xlib::Display } - #[cfg(any(feature = "xlib", docsrs))] + #[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] #[doc(alias = "gdk_x11_display_get_xscreen")] #[doc(alias = "get_xscreen")] @@ -65,7 +65,7 @@ impl X11Display { ffi::gdk_x11_display_get_xscreen(self.to_glib_none().0) as *mut xlib::Screen } - #[cfg(any(feature = "xlib", docsrs))] + #[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] #[doc(alias = "xevent")] pub unsafe fn connect_xevent glib::Propagation + 'static>( diff --git a/gdk4-x11/src/x11_monitor.rs b/gdk4-x11/src/x11_monitor.rs index a87ec3e90230..0474927878e2 100644 --- a/gdk4-x11/src/x11_monitor.rs +++ b/gdk4-x11/src/x11_monitor.rs @@ -4,7 +4,7 @@ use crate::X11Monitor; #[cfg(not(feature = "xlib"))] use crate::XID; use glib::translate::*; -#[cfg(any(feature = "xlib", docsrs))] +#[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] use x11::xlib::XID; diff --git a/gdk4-x11/src/x11_screen.rs b/gdk4-x11/src/x11_screen.rs index fbc35de50321..e1a5a657289d 100644 --- a/gdk4-x11/src/x11_screen.rs +++ b/gdk4-x11/src/x11_screen.rs @@ -4,12 +4,12 @@ use crate::X11Screen; #[cfg(not(feature = "xlib"))] use crate::XID; use glib::translate::*; -#[cfg(any(feature = "xlib", docsrs))] +#[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] use x11::xlib::{self, XID}; impl X11Screen { - #[cfg(any(feature = "xlib", docsrs))] + #[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] #[doc(alias = "gdk_x11_screen_get_xscreen")] #[doc(alias = "get_xscreen")] diff --git a/gdk4-x11/src/x11_surface.rs b/gdk4-x11/src/x11_surface.rs index 12cabe56291a..b073f96948bb 100644 --- a/gdk4-x11/src/x11_surface.rs +++ b/gdk4-x11/src/x11_surface.rs @@ -4,7 +4,7 @@ use crate::X11Surface; #[cfg(not(feature = "xlib"))] use crate::XWindow; use glib::translate::*; -#[cfg(any(feature = "xlib", docsrs))] +#[cfg(feature = "xlib")] #[cfg_attr(docsrs, doc(cfg(feature = "xlib")))] use x11::xlib::Window as XWindow; diff --git a/gdk4/src/content_formats.rs b/gdk4/src/content_formats.rs index b26be3d3f048..8e4eaeab0635 100644 --- a/gdk4/src/content_formats.rs +++ b/gdk4/src/content_formats.rs @@ -25,7 +25,7 @@ impl ContentFormats { } } -#[cfg(any(feature = "v4_4", docsrs))] +#[cfg(feature = "v4_4")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_4")))] impl std::str::FromStr for ContentFormats { type Err = glib::BoolError; diff --git a/gdk4/src/drag_surface.rs b/gdk4/src/drag_surface.rs index 7b23a3921c79..d7294d13147b 100644 --- a/gdk4/src/drag_surface.rs +++ b/gdk4/src/drag_surface.rs @@ -15,7 +15,7 @@ mod sealed { // rustdoc-stripper-ignore-next /// Trait containing manually implemented methods of [`DragSurface`](crate::DragSurface). pub trait DragSurfaceExtManual: sealed::Sealed + IsA { - #[cfg(any(feature = "v4_12", docsrs))] + #[cfg(feature = "v4_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))] #[doc(alias = "compute-size")] fn connect_compute_size( diff --git a/gdk4/src/lib.rs b/gdk4/src/lib.rs index 03715f386dd7..7b8d22b9e382 100644 --- a/gdk4/src/lib.rs +++ b/gdk4/src/lib.rs @@ -7,7 +7,7 @@ pub use cairo; pub use ffi; pub use gdk_pixbuf; pub use gio; -#[cfg(any(feature = "gl", docsrs))] +#[cfg(feature = "gl")] #[cfg_attr(docsrs, doc(cfg(feature = "gl")))] pub use gl; pub use glib; @@ -73,10 +73,10 @@ mod crossing_event; mod delete_event; mod display; mod dnd_event; -#[cfg(any(feature = "v4_12", docsrs))] +#[cfg(feature = "v4_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))] mod drag_surface; -#[cfg(any(feature = "v4_12", docsrs))] +#[cfg(feature = "v4_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))] mod drag_surface_size; mod draw_context; @@ -84,7 +84,7 @@ mod drop; mod focus_event; mod functions; mod gl_texture; -#[cfg(any(feature = "v4_12", docsrs))] +#[cfg(feature = "v4_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))] mod gl_texture_builder; mod grab_broken_event; @@ -112,7 +112,7 @@ pub use auto::*; pub use functions::*; pub use display::Backend; -#[cfg(any(feature = "v4_12", docsrs))] +#[cfg(feature = "v4_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))] pub use drag_surface_size::DragSurfaceSize; pub use keymap_key::KeymapKey; diff --git a/gdk4/src/prelude.rs b/gdk4/src/prelude.rs index 3f38c2f0df1c..474e05012231 100644 --- a/gdk4/src/prelude.rs +++ b/gdk4/src/prelude.rs @@ -8,7 +8,7 @@ pub use crate::auto::traits::*; pub use crate::cairo_interaction::{GdkCairoContextExt, GdkCairoSurfaceExt}; pub use crate::content_provider::ContentProviderExtManual; pub use crate::display::DisplayExtManual; -#[cfg(any(feature = "v4_12", docsrs))] +#[cfg(feature = "v4_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))] pub use crate::drag_surface::DragSurfaceExtManual; pub use crate::draw_context::DrawContextExtManual; diff --git a/gsk4/src/lib.rs b/gsk4/src/lib.rs index 9a90411ada63..b615c9064def 100644 --- a/gsk4/src/lib.rs +++ b/gsk4/src/lib.rs @@ -49,10 +49,10 @@ mod gl_shader; mod gl_shader_node; mod inset_shadow_node; mod linear_gradient_node; -#[cfg(any(feature = "v4_10", docsrs))] +#[cfg(feature = "v4_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] mod mask_node; -#[cfg(any(feature = "v4_2", docsrs))] +#[cfg(feature = "v4_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))] mod ngl_renderer; mod opacity_node; @@ -66,14 +66,14 @@ mod rounded_clip_node; mod shadow_node; mod text_node; mod texture_node; -#[cfg(any(feature = "v4_10", docsrs))] +#[cfg(feature = "v4_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] mod texture_scale_node; mod transform; mod transform_node; pub use color_stop::ColorStop; -#[cfg(any(feature = "v4_2", docsrs))] +#[cfg(feature = "v4_2")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))] #[cfg_attr(feature = "v4_4", deprecated = "Since 4.4")] pub use ngl_renderer::NglRenderer; diff --git a/gsk4/src/render_node.rs b/gsk4/src/render_node.rs index 05286d0a665e..970267244a4c 100644 --- a/gsk4/src/render_node.rs +++ b/gsk4/src/render_node.rs @@ -164,13 +164,13 @@ macro_rules! define_render_node { } } - #[cfg(any(feature = "v4_6", docsrs))] + #[cfg(feature = "v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] impl glib::value::ValueType for $rust_type { type Type = Self; } - #[cfg(any(feature = "v4_6", docsrs))] + #[cfg(feature = "v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] unsafe impl<'a> glib::value::FromValue<'a> for $rust_type { type Checker = glib::value::GenericValueTypeOrNoneChecker; @@ -184,7 +184,7 @@ macro_rules! define_render_node { } } - #[cfg(any(feature = "v4_6", docsrs))] + #[cfg(feature = "v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] impl glib::value::ToValue for $rust_type { #[inline] @@ -206,7 +206,7 @@ macro_rules! define_render_node { } } - #[cfg(any(feature = "v4_6", docsrs))] + #[cfg(feature = "v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] impl glib::value::ToValueOptional for $rust_type { #[inline] diff --git a/gsk4/src/transform.rs b/gsk4/src/transform.rs index aa272d0c5c8e..9cebaae67504 100644 --- a/gsk4/src/transform.rs +++ b/gsk4/src/transform.rs @@ -86,7 +86,7 @@ impl Transform { } } - #[cfg(any(feature = "v4_6", docsrs))] + #[cfg(feature = "v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] #[doc(alias = "gsk_transform_skew")] #[must_use] diff --git a/gtk4/src/expression_watch.rs b/gtk4/src/expression_watch.rs index b36270cae4d0..fe0520f8b524 100644 --- a/gtk4/src/expression_watch.rs +++ b/gtk4/src/expression_watch.rs @@ -47,7 +47,7 @@ impl ExpressionWatch { } } -#[cfg(any(feature = "v4_2", docsrs))] +#[cfg(feature = "v4_2")] impl glib::StaticType for ExpressionWatch { #[doc(alias = "gtk_expression_watch_get_type")] #[inline] diff --git a/gtk4/src/lib.rs b/gtk4/src/lib.rs index 3101d4a951ed..df88962325cd 100644 --- a/gtk4/src/lib.rs +++ b/gtk4/src/lib.rs @@ -142,7 +142,7 @@ mod file_chooser; mod file_chooser_dialog; mod flow_box; mod font_chooser; -#[cfg(any(feature = "v4_10", docsrs))] +#[cfg(feature = "v4_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] mod font_dialog; mod functions; @@ -166,7 +166,7 @@ mod overlay; mod pad_action_entry; mod page_range; mod param_spec_expression; -#[cfg(any(target_os = "linux", docsrs))] +#[cfg(target_os = "linux")] #[cfg_attr(docsrs, doc(cfg(target_os = "linux")))] mod print_job; mod print_operation; diff --git a/gtk4/src/subclass/check_button.rs b/gtk4/src/subclass/check_button.rs index 7236c0ec1b58..02e9c16f1257 100644 --- a/gtk4/src/subclass/check_button.rs +++ b/gtk4/src/subclass/check_button.rs @@ -11,7 +11,8 @@ pub trait CheckButtonImpl: CheckButtonImplExt + WidgetImpl { self.parent_toggled() } - #[cfg(any(feature = "v4_2", docsrs))] + #[cfg(feature = "v4_2")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))] fn activate(&self) { self.parent_activate() } @@ -33,7 +34,8 @@ pub trait CheckButtonImplExt: sealed::Sealed + ObjectSubclass { } } - #[cfg(any(feature = "v4_2", docsrs))] + #[cfg(feature = "v4_2")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))] fn parent_activate(&self) { unsafe { let data = Self::type_data(); @@ -54,7 +56,8 @@ unsafe impl IsSubclassable for CheckButton { let klass = class.as_mut(); klass.toggled = Some(check_button_toggled::); - #[cfg(any(feature = "v4_2", docsrs))] + #[cfg(feature = "v4_2")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))] { klass.activate = Some(check_button_activate::); }; @@ -68,7 +71,8 @@ unsafe extern "C" fn check_button_toggled(ptr: *mut ffi::Gtk imp.toggled() } -#[cfg(any(feature = "v4_2", docsrs))] +#[cfg(feature = "v4_2")] +#[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))] unsafe extern "C" fn check_button_activate(ptr: *mut ffi::GtkCheckButton) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/combo_box.rs b/gtk4/src/subclass/combo_box.rs index 696996d50ade..27d026eee5d1 100644 --- a/gtk4/src/subclass/combo_box.rs +++ b/gtk4/src/subclass/combo_box.rs @@ -9,7 +9,8 @@ use glib::{translate::*, GString}; #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] pub trait ComboBoxImpl: ComboBoxImplExt + WidgetImpl { - #[cfg(any(feature = "v4_6", docsrs))] + #[cfg(feature = "v4_6")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] fn activate(&self) { self.parent_activate() } @@ -29,7 +30,8 @@ mod sealed { #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")] #[allow(deprecated)] pub trait ComboBoxImplExt: sealed::Sealed + ObjectSubclass { - #[cfg(any(feature = "v4_6", docsrs))] + #[cfg(feature = "v4_6")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] fn parent_activate(&self) { unsafe { let data = Self::type_data(); @@ -72,7 +74,8 @@ unsafe impl IsSubclassable for ComboBox { let klass = class.as_mut(); klass.changed = Some(combo_box_changed::); klass.format_entry_text = Some(combo_box_format_entry_text::); - #[cfg(any(feature = "v4_6", docsrs))] + #[cfg(feature = "v4_6")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] { klass.activate = Some(combo_box_activate::); }; @@ -97,7 +100,8 @@ unsafe extern "C" fn combo_box_format_entry_text( imp.format_entry_text(path.as_str()).into_glib_ptr() } -#[cfg(any(feature = "v4_6", docsrs))] +#[cfg(feature = "v4_6")] +#[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] unsafe extern "C" fn combo_box_activate(ptr: *mut ffi::GtkComboBox) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/im_context.rs b/gtk4/src/subclass/im_context.rs index 190e8b5a8cdf..a83b79d155f6 100644 --- a/gtk4/src/subclass/im_context.rs +++ b/gtk4/src/subclass/im_context.rs @@ -61,7 +61,8 @@ pub trait IMContextImpl: IMContextImplExt + ObjectImpl { fn set_use_preedit(&self, use_preedit: bool) { self.parent_set_use_preedit(use_preedit) } - #[cfg(any(feature = "v4_10", docsrs))] + #[cfg(feature = "v4_10")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] fn activate_osk(&self) { self.parent_activate_osk() } @@ -297,7 +298,8 @@ pub trait IMContextImplExt: sealed::Sealed + ObjectSubclass { } } - #[cfg(any(feature = "v4_10", docsrs))] + #[cfg(feature = "v4_10")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] fn parent_activate_osk(&self) { unsafe { let data = Self::type_data(); @@ -334,7 +336,8 @@ unsafe impl IsSubclassable for IMContext { klass.set_cursor_location = Some(im_context_set_cursor_location::); klass.set_surrounding = Some(im_context_set_surrounding::); klass.set_use_preedit = Some(im_context_set_use_preedit::); - #[cfg(any(feature = "v4_10", docsrs))] + #[cfg(feature = "v4_10")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] { klass.activate_osk = Some(im_context_activate_osk::); }; @@ -511,7 +514,8 @@ unsafe extern "C" fn im_context_set_use_preedit( imp.set_use_preedit(from_glib(use_preedit)) } -#[cfg(any(feature = "v4_10", docsrs))] +#[cfg(feature = "v4_10")] +#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] unsafe extern "C" fn im_context_activate_osk(ptr: *mut ffi::GtkIMContext) { let instance = &*(ptr as *mut T::Instance); let imp = instance.imp(); diff --git a/gtk4/src/subclass/mod.rs b/gtk4/src/subclass/mod.rs index 023fdf0816ad..e0b92e730449 100644 --- a/gtk4/src/subclass/mod.rs +++ b/gtk4/src/subclass/mod.rs @@ -14,10 +14,10 @@ impl Drop for PtrHolder { } } -#[cfg(any(feature = "v4_10", docsrs))] +#[cfg(feature = "v4_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] pub mod accessible; -#[cfg(any(feature = "v4_10", docsrs))] +#[cfg(feature = "v4_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] pub mod accessible_range; pub mod actionable; @@ -68,14 +68,14 @@ pub mod root; pub mod scale; pub mod scale_button; pub mod scrollable; -#[cfg(any(feature = "v4_12", docsrs))] +#[cfg(feature = "v4_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))] pub mod section_model; pub mod selection_model; pub mod shortcut_manager; pub mod sorter; pub mod style_context; -#[cfg(any(feature = "v4_6", docsrs))] +#[cfg(feature = "v4_6")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] pub mod symbolic_paintable; pub mod text_buffer; @@ -99,10 +99,10 @@ pub mod prelude { #[doc(hidden)] pub use glib::subclass::prelude::*; - #[cfg(any(feature = "v4_10", docsrs))] + #[cfg(feature = "v4_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] pub use super::accessible::{AccessibleImpl, AccessibleImplExt}; - #[cfg(any(feature = "v4_10", docsrs))] + #[cfg(feature = "v4_10")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))] pub use super::accessible_range::{AccessibleRangeImpl, AccessibleRangeImplExt}; pub use super::actionable::{ActionableImpl, ActionableImplExt}; @@ -153,14 +153,15 @@ pub mod prelude { pub use super::scale::{ScaleImpl, ScaleImplExt}; pub use super::scale_button::{ScaleButtonImpl, ScaleButtonImplExt}; pub use super::scrollable::{ScrollableImpl, ScrollableImplExt}; - #[cfg(any(feature = "v4_12", docsrs))] + #[cfg(feature = "v4_12")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))] pub use super::section_model::{SectionModelImpl, SectionModelImplExt}; pub use super::selection_model::{SelectionModelImpl, SelectionModelImplExt}; pub use super::shortcut_manager::{ShortcutManagerImpl, ShortcutManagerImplExt}; pub use super::sorter::{SorterImpl, SorterImplExt}; pub use super::style_context::{StyleContextImpl, StyleContextImplExt}; - #[cfg(any(feature = "v4_6", docsrs))] + #[cfg(feature = "v4_6")] + #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))] pub use super::symbolic_paintable::{SymbolicPaintableImpl, SymbolicPaintableImplExt}; pub use super::text_buffer::{TextBufferImpl, TextBufferImplExt}; diff --git a/gtk4/src/subclass/widget.rs b/gtk4/src/subclass/widget.rs index e7a173594c34..369fadaf7159 100644 --- a/gtk4/src/subclass/widget.rs +++ b/gtk4/src/subclass/widget.rs @@ -1408,7 +1408,7 @@ where } pub trait CompositeTemplateDisposeExt { - #[cfg(any(feature = "v4_8", docsrs))] + #[cfg(feature = "v4_8")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))] fn dispose_template(&self); } @@ -1418,7 +1418,7 @@ where T: WidgetImpl + CompositeTemplate, ::Type: IsA, { - #[cfg(any(feature = "v4_8", docsrs))] + #[cfg(feature = "v4_8")] #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))] fn dispose_template(&self) { unsafe { From db07e02f4bb5b84a924fde373f7b1152dc79c5a2 Mon Sep 17 00:00:00 2001 From: pentamassiv Date: Sat, 5 Aug 2023 15:16:55 +0200 Subject: [PATCH 2/2] More changes for docsrs --- gtk4/src/signal_list_item_factory.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gtk4/src/signal_list_item_factory.rs b/gtk4/src/signal_list_item_factory.rs index f951feabbd58..5b2a2a39b4bf 100644 --- a/gtk4/src/signal_list_item_factory.rs +++ b/gtk4/src/signal_list_item_factory.rs @@ -1,21 +1,21 @@ // Take a look at the license at the top of the repository in the LICENSE file. -#[cfg(not(any(feature = "v4_8", docsrs)))] +#[cfg(not(feature = "v4_8"))] use crate::{prelude::*, ListItem}; use crate::SignalListItemFactory; -#[cfg(not(any(feature = "v4_8", docsrs)))] +#[cfg(not(feature = "v4_8"))] use glib::{ signal::{connect_raw, SignalHandlerId}, translate::*, }; -#[cfg(not(any(feature = "v4_8", docsrs)))] +#[cfg(not(feature = "v4_8"))] use std::{boxed::Box as Box_, mem::transmute}; impl SignalListItemFactory { #[doc(alias = "bind")] - #[cfg(not(any(feature = "v4_8", docsrs)))] + #[cfg(not(feature = "v4_8"))] pub fn connect_bind(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn bind_trampoline( this: *mut ffi::GtkSignalListItemFactory, @@ -39,7 +39,7 @@ impl SignalListItemFactory { } #[doc(alias = "setup")] - #[cfg(not(any(feature = "v4_8", docsrs)))] + #[cfg(not(feature = "v4_8"))] pub fn connect_setup(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn setup_trampoline< F: Fn(&SignalListItemFactory, &ListItem) + 'static, @@ -65,7 +65,7 @@ impl SignalListItemFactory { } #[doc(alias = "teardown")] - #[cfg(not(any(feature = "v4_8", docsrs)))] + #[cfg(not(feature = "v4_8"))] pub fn connect_teardown(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn teardown_trampoline< F: Fn(&SignalListItemFactory, &ListItem) + 'static, @@ -91,7 +91,7 @@ impl SignalListItemFactory { } #[doc(alias = "unbind")] - #[cfg(not(any(feature = "v4_8", docsrs)))] + #[cfg(not(feature = "v4_8"))] pub fn connect_unbind(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn unbind_trampoline< F: Fn(&SignalListItemFactory, &ListItem) + 'static,