Skip to content

Commit 2faf89a

Browse files
Don't seal manual traits that correspond to auto-generated types
As those have already the IsA<T> restriction which is an unsafe trait, implemented by the glib::wrapper! macro. The Unichar trait is still sealed though
1 parent 25fee3a commit 2faf89a

37 files changed

+37
-230
lines changed

gdk-pixbuf/src/pixbuf_animation.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ use glib::{prelude::*, translate::*};
66

77
use crate::{ffi, PixbufAnimation, PixbufAnimationIter};
88

9-
mod sealed {
10-
pub trait Sealed {}
11-
impl<T: super::IsA<super::PixbufAnimation>> Sealed for T {}
12-
}
13-
14-
pub trait PixbufAnimationExtManual: sealed::Sealed + IsA<PixbufAnimation> + 'static {
9+
pub trait PixbufAnimationExtManual: IsA<PixbufAnimation> + 'static {
1510
#[doc(alias = "gdk_pixbuf_animation_get_iter")]
1611
#[doc(alias = "get_iter")]
1712
fn iter(&self, start_time: Option<SystemTime>) -> PixbufAnimationIter {

gio/src/action_map.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
use glib::{clone, prelude::*};
44

55
use crate::{prelude::*, ActionEntry, ActionMap, SimpleAction};
6-
7-
mod sealed {
8-
pub trait Sealed {}
9-
impl<T: super::IsA<super::ActionMap>> Sealed for T {}
10-
}
11-
12-
pub trait ActionMapExtManual: sealed::Sealed + IsA<ActionMap> {
6+
pub trait ActionMapExtManual: IsA<ActionMap> {
137
#[doc(alias = "g_action_map_add_action_entries")]
148
fn add_action_entries(&self, entries: impl IntoIterator<Item = ActionEntry<Self>>) {
159
for entry in entries.into_iter() {

gio/src/app_info.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ use glib::translate::*;
99

1010
use crate::{ffi, AppInfo, AppLaunchContext, Cancellable};
1111

12-
mod sealed {
13-
pub trait Sealed {}
14-
impl<T: super::IsA<super::AppInfo>> Sealed for T {}
15-
}
16-
17-
pub trait AppInfoExtManual: sealed::Sealed + IsA<AppInfo> + 'static {
12+
pub trait AppInfoExtManual: IsA<AppInfo> + 'static {
1813
#[cfg_attr(docsrs, doc(cfg(feature = "v2_60")))]
1914
#[doc(alias = "g_app_info_launch_uris_async")]
2015
fn launch_uris_async<

gio/src/application.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ use glib::{
1111

1212
use crate::{ffi, Application, File};
1313

14-
mod sealed {
15-
pub trait Sealed {}
16-
impl<T: super::IsA<super::Application>> Sealed for T {}
17-
}
18-
19-
pub trait ApplicationExtManual: sealed::Sealed + IsA<Application> {
14+
pub trait ApplicationExtManual: IsA<Application> {
2015
#[doc(alias = "g_application_run")]
2116
fn run(&self) -> ExitCode {
2217
self.run_with_args(&std::env::args().collect::<Vec<_>>())

gio/src/cancellable.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ impl TryFromGlib<libc::c_ulong> for CancelledHandlerId {
3232
}
3333
}
3434

35-
mod sealed {
36-
pub trait Sealed {}
37-
impl<T: super::IsA<super::Cancellable>> Sealed for T {}
38-
}
39-
40-
pub trait CancellableExtManual: sealed::Sealed + IsA<Cancellable> {
35+
pub trait CancellableExtManual: IsA<Cancellable> {
4136
// rustdoc-stripper-ignore-next
4237
/// Convenience function to connect to the `signal::Cancellable::cancelled` signal. Also
4338
/// handles the race condition that may happen if the cancellable is cancelled right before

gio/src/converter.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ use glib::{prelude::*, translate::*};
66

77
use crate::{ffi, Converter, ConverterFlags, ConverterResult};
88

9-
mod sealed {
10-
pub trait Sealed {}
11-
impl<T: super::IsA<super::Converter>> Sealed for T {}
12-
}
13-
14-
pub trait ConverterExtManual: sealed::Sealed + IsA<Converter> + 'static {
9+
pub trait ConverterExtManual: IsA<Converter> + 'static {
1510
#[doc(alias = "g_converter_convert")]
1611
fn convert<IN: AsRef<[u8]>, OUT: AsMut<[u8]>>(
1712
&self,

gio/src/data_input_stream.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ use glib::{prelude::*, translate::*, GString};
66

77
use crate::{ffi, Cancellable, DataInputStream};
88

9-
mod sealed {
10-
pub trait Sealed {}
11-
impl<T: super::IsA<super::DataInputStream>> Sealed for T {}
12-
}
13-
14-
pub trait DataInputStreamExtManual: sealed::Sealed + IsA<DataInputStream> + 'static {
9+
pub trait DataInputStreamExtManual: IsA<DataInputStream> + 'static {
1510
#[doc(alias = "g_data_input_stream_read_line")]
1611
fn read_line<P: IsA<Cancellable>>(
1712
&self,

gio/src/datagram_based.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@ use glib::{prelude::*, translate::*};
77

88
use crate::{ffi, Cancellable, DatagramBased, InputMessage, OutputMessage};
99

10-
mod sealed {
11-
pub trait Sealed {}
12-
impl<T: super::IsA<super::DatagramBased>> Sealed for T {}
13-
}
14-
15-
pub trait DatagramBasedExtManual: sealed::Sealed + IsA<DatagramBased> + Sized {
10+
pub trait DatagramBasedExtManual: IsA<DatagramBased> + Sized {
1611
#[doc(alias = "g_datagram_based_create_source")]
1712
fn create_source<F, C>(
1813
&self,

gio/src/dbus_proxy.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ use glib::{prelude::*, signal::connect_raw, translate::*, SignalHandlerId};
66

77
use crate::{ffi, DBusProxy};
88

9-
mod sealed {
10-
pub trait Sealed {}
11-
impl<T: super::IsA<super::DBusProxy>> Sealed for T {}
12-
}
13-
14-
pub trait DBusProxyExtManual: sealed::Sealed + IsA<DBusProxy> + 'static {
9+
pub trait DBusProxyExtManual: IsA<DBusProxy> + 'static {
1510
#[cfg(feature = "v2_72")]
1611
#[doc(alias = "g-signal")]
1712
fn connect_g_signal<

gio/src/debug_controller_dbus.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ use glib::prelude::*;
44

55
use crate::{DBusConnection, DebugControllerDBus};
66

7-
mod sealed {
8-
pub trait Sealed {}
9-
impl<T: super::IsA<super::DebugControllerDBus>> Sealed for T {}
10-
}
11-
12-
pub trait DebugControllerDBusExtManual: sealed::Sealed + IsA<DebugControllerDBus> + Sized {
7+
pub trait DebugControllerDBusExtManual: IsA<DebugControllerDBus> + Sized {
138
fn connection(&self) -> DBusConnection {
149
ObjectExt::property(self.as_ref(), "connection")
1510
}

0 commit comments

Comments
 (0)