Skip to content

Commit

Permalink
misc: Use nightly rustfmt on manual source code
Browse files Browse the repository at this point in the history
The imports grouping & docs bits are super handy.
  • Loading branch information
bilelmoussaoui committed Oct 16, 2023
1 parent 2ff4a77 commit cb70f6b
Show file tree
Hide file tree
Showing 233 changed files with 1,061 additions and 719 deletions.
8 changes: 3 additions & 5 deletions gdk4-wayland/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ pub use ffi;
pub use gdk;
pub use gio;
pub use glib;
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub use wayland_client;

#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
pub use khronos_egl;

#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
pub use wayland_client;
#[cfg(all(feature = "v4_4", feature = "xkb_crate"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "xkb_crate"))))]
pub use xkb;
Expand Down
4 changes: 2 additions & 2 deletions gdk4-wayland/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
// rustdoc-stripper-ignore-next
//! Traits intended for blanket imports.
pub use crate::wayland_surface::WaylandSurfaceExtManual;

#[doc(hidden)]
pub use gdk::prelude::*;
#[doc(hidden)]
pub use gio::prelude::*;
#[doc(hidden)]
pub use glib::prelude::*;

pub use crate::wayland_surface::WaylandSurfaceExtManual;
11 changes: 5 additions & 6 deletions gdk4-wayland/src/wayland_device.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
// Take a look at the license at the top of the repository in the LICENSE file.

#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use crate::prelude::*;
use crate::WaylandDevice;
#[cfg(any(feature = "wayland_crate", feature = "xkb_crate"))]
#[cfg_attr(
docsrs,
doc(cfg(any(feature = "wayland_crate", feature = "xkb_crate")))
)]
use glib::translate::*;

#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use wayland_client::{
backend::ObjectId,
protocol::{wl_keyboard::WlKeyboard, wl_pointer::WlPointer, wl_seat::WlSeat},
Proxy,
};

#[cfg(all(feature = "v4_4", feature = "xkb_crate"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "xkb_crate"))))]
use xkb::Keymap;

#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use crate::prelude::*;
use crate::WaylandDevice;

impl WaylandDevice {
#[doc(alias = "gdk_wayland_device_get_wl_keyboard")]
#[doc(alias = "get_wl_keyboard")]
Expand Down
5 changes: 2 additions & 3 deletions gdk4-wayland/src/wayland_display.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::WaylandDisplay;
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use glib::{once_cell::sync::Lazy, prelude::*, translate::*, Quark};

#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
use khronos_egl as egl;

#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use wayland_client::{
Expand All @@ -17,6 +14,8 @@ use wayland_client::{
Proxy,
};

use crate::WaylandDisplay;

#[cfg(feature = "wayland_crate")]
static WAYLAND_DISPLAY_CONNECTION_QUARK: Lazy<Quark> =
Lazy::new(|| Quark::from_str("gtk-rs-wayland-display-connection-quark"));
Expand Down
8 changes: 4 additions & 4 deletions gdk4-wayland/src/wayland_monitor.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::WaylandMonitor;
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use {crate::prelude::*, glib::translate::*};

use wayland_client::{backend::ObjectId, protocol::wl_output::WlOutput, Proxy};
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use wayland_client::{backend::ObjectId, protocol::wl_output::WlOutput, Proxy};
use {crate::prelude::*, glib::translate::*};

use crate::WaylandMonitor;

impl WaylandMonitor {
#[doc(alias = "gdk_wayland_monitor_get_wl_output")]
Expand Down
8 changes: 4 additions & 4 deletions gdk4-wayland/src/wayland_seat.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::WaylandSeat;
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use {crate::prelude::*, glib::translate::*};

use wayland_client::{backend::ObjectId, protocol::wl_seat::WlSeat, Proxy};
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use wayland_client::{backend::ObjectId, protocol::wl_seat::WlSeat, Proxy};
use {crate::prelude::*, glib::translate::*};

use crate::WaylandSeat;

impl WaylandSeat {
#[doc(alias = "gdk_wayland_seat_get_wl_seat")]
Expand Down
7 changes: 4 additions & 3 deletions gdk4-wayland/src/wayland_surface.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{prelude::*, WaylandSurface};
#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use glib::translate::*;

#[cfg(feature = "wayland_crate")]
#[cfg_attr(docsrs, doc(cfg(feature = "wayland_crate")))]
use wayland_client::{backend::ObjectId, protocol::wl_surface::WlSurface, Proxy};

use crate::{prelude::*, WaylandSurface};

mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::WaylandSurface>> Sealed for T {}
}

// rustdoc-stripper-ignore-next
/// Trait containing manually implemented methods of [`WaylandSurface`](crate::WaylandSurface).
/// Trait containing manually implemented methods of
/// [`WaylandSurface`](crate::WaylandSurface).
pub trait WaylandSurfaceExtManual: sealed::Sealed + IsA<WaylandSurface> + 'static {
#[doc(alias = "gdk_wayland_surface_get_wl_surface")]
#[doc(alias = "get_wl_surface")]
Expand Down
4 changes: 2 additions & 2 deletions gdk4-win32/src/win32_display.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{Win32Display, Win32MessageFilterReturn, MSG};
use glib::translate::*;

#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
use khronos_egl as egl;

use crate::{Win32Display, Win32MessageFilterReturn, MSG};

impl Win32Display {
#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
Expand Down
6 changes: 4 additions & 2 deletions gdk4-win32/src/win32_hcursor.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{prelude::*, Win32HCursor, HCURSOR};
use glib::{translate::*, types::Pointee};
use std::ptr::NonNull;

use glib::{translate::*, types::Pointee};

use crate::{prelude::*, Win32HCursor, HCURSOR};

impl Win32HCursor {
#[doc(alias = "gdk_win32_hcursor_new")]
pub fn new(
Expand Down
4 changes: 2 additions & 2 deletions gdk4-win32/src/win32_surface.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{prelude::*, Win32Surface, HWND};

use glib::translate::*;

use crate::{prelude::*, Win32Surface, HWND};

impl Win32Surface {
#[doc(alias = "gdk_win32_surface_lookup_for_display")]
pub fn lookup_for_display(
Expand Down
10 changes: 5 additions & 5 deletions gdk4-x11/src/functions.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Take a look at the license at the top of the repository in the LICENSE file.

pub use crate::auto::functions::*;
use crate::X11Display;
use glib::{translate::*, IntoGStr};

#[cfg(not(feature = "xlib"))]
use crate::XAtom;
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::Atom as XAtom;

pub use crate::auto::functions::*;
use crate::X11Display;
#[cfg(not(feature = "xlib"))]
use crate::XAtom;

#[doc(alias = "gdk_x11_get_xatom_by_name_for_display")]
pub fn x11_get_xatom_by_name_for_display(display: &X11Display, atom_name: impl IntoGStr) -> XAtom {
skip_assert_initialized!();
Expand Down
7 changes: 3 additions & 4 deletions gdk4-x11/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ pub use ffi;
pub use gdk;
pub use gio;
pub use glib;
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
pub use x11;

#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
pub use khronos_egl;
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
pub use x11;
#[macro_use]
mod rt;

Expand Down
15 changes: 8 additions & 7 deletions gdk4-x11/src/x11_display.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{prelude::*, X11Display};
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use std::{boxed::Box as Box_, mem::transmute};

#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use glib::signal::{connect_raw, SignalHandlerId};
use glib::{translate::*, IntoGStr};
#[cfg(all(feature = "v4_4", feature = "egl"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "v4_4", feature = "egl"))))]
use khronos_egl as egl;
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use std::{boxed::Box as Box_, mem::transmute};
use x11::xlib;
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib;
use x11::xlib::{Cursor as XCursor, Window as XWindow};

use crate::{prelude::*, X11Display};
#[cfg(not(feature = "xlib"))]
use crate::{XCursor, XWindow};
use glib::{translate::*, IntoGStr};
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::{Cursor as XCursor, Window as XWindow};

impl X11Display {
#[cfg(all(feature = "v4_4", feature = "egl"))]
Expand Down
7 changes: 4 additions & 3 deletions gdk4-x11/src/x11_monitor.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::X11Monitor;
#[cfg(not(feature = "xlib"))]
use crate::XID;
use glib::translate::*;
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::XID;

use crate::X11Monitor;
#[cfg(not(feature = "xlib"))]
use crate::XID;

impl X11Monitor {
#[doc(alias = "gdk_x11_monitor_get_output")]
#[doc(alias = "get_output")]
Expand Down
7 changes: 4 additions & 3 deletions gdk4-x11/src/x11_screen.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::X11Screen;
#[cfg(not(feature = "xlib"))]
use crate::XID;
use glib::translate::*;
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::{self, XID};

use crate::X11Screen;
#[cfg(not(feature = "xlib"))]
use crate::XID;

impl X11Screen {
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
Expand Down
7 changes: 4 additions & 3 deletions gdk4-x11/src/x11_surface.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::X11Surface;
#[cfg(not(feature = "xlib"))]
use crate::XWindow;
use glib::translate::*;
#[cfg(feature = "xlib")]
#[cfg_attr(docsrs, doc(cfg(feature = "xlib")))]
use x11::xlib::Window as XWindow;

use crate::X11Surface;
#[cfg(not(feature = "xlib"))]
use crate::XWindow;

impl X11Surface {
#[doc(alias = "gdk_x11_surface_get_xid")]
#[doc(alias = "get_xid")]
Expand Down
4 changes: 1 addition & 3 deletions gdk4/src/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
// rustdoc-stripper-ignore-next
//! Builder pattern types.
pub use crate::auto::builders::*;
pub use crate::rgba::RGBABuilder;
pub use crate::ContentFormatsBuilder;
#[cfg(feature = "v4_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
pub use crate::GLTextureBuilder;
pub use crate::{auto::builders::*, rgba::RGBABuilder, ContentFormatsBuilder};
3 changes: 2 additions & 1 deletion gdk4/src/button_event.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{ButtonEvent, EventType};
use std::fmt;

use crate::{ButtonEvent, EventType};

define_event! {
ButtonEvent,
ffi::GdkButtonEvent,
Expand Down
3 changes: 2 additions & 1 deletion gdk4/src/cairo_interaction.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{Rectangle, Surface, RGBA};
use cairo::{Context, Region};
use gdk_pixbuf::Pixbuf;
use glib::translate::*;

use crate::{Rectangle, Surface, RGBA};

// rustdoc-stripper-ignore-next
/// Trait containing integration methods with [`cairo::Surface`].
pub trait GdkCairoSurfaceExt {
Expand Down
7 changes: 4 additions & 3 deletions gdk4/src/clipboard.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{prelude::*, Clipboard};
use glib::translate::*;
use glib::GString;
use std::{future, pin::Pin, ptr};

use glib::{translate::*, GString};

use crate::{prelude::*, Clipboard};

impl Clipboard {
#[doc(alias = "gdk_clipboard_read_async")]
pub fn read_async<Q: FnOnce(Result<(gio::InputStream, GString), glib::Error>) + 'static>(
Expand Down
7 changes: 4 additions & 3 deletions gdk4/src/content_deserializer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use glib::{translate::*, value::FromValue};

use crate::ContentDeserializer;
use glib::translate::*;
use glib::value::FromValue;

impl ContentDeserializer {
pub fn set_value(&self, value: glib::Value) {
Expand All @@ -26,7 +26,8 @@ impl ContentDeserializer {
}

// rustdoc-stripper-ignore-next
/// Similar to [`Self::value`] but panics if the value is of a different type.
/// Similar to [`Self::value`] but panics if the value is of a different
/// type.
#[doc(alias = "gdk_content_deserializer_get_value")]
#[doc(alias = "get_value")]
pub fn value_as<V: for<'b> FromValue<'b> + 'static>(&self) -> V {
Expand Down
Loading

0 comments on commit cb70f6b

Please sign in to comment.