From 892f71d709d59ba3f7e0199479f06dd9bb65aa9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 3 Dec 2021 12:59:10 +0200 Subject: [PATCH 1/3] Update gir See https://github.com/gtk-rs/gir/pull/1280 --- gir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gir b/gir index 02eb99133f11..50377b886959 160000 --- a/gir +++ b/gir @@ -1 +1 @@ -Subproject commit 02eb99133f11749f3e6b959f060f55bbcffe9994 +Subproject commit 50377b88695979e542e4b276f6fead7a0c6d1d84 From 3d87909ce674b1aeaf6a5d34f3efbfa39a9c099c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 3 Dec 2021 13:00:27 +0200 Subject: [PATCH 2/3] Regenerate with latest gir --- gdk-pixbuf/src/auto/versions.txt | 2 +- gdk-pixbuf/sys/versions.txt | 2 +- gio/src/auto/application.rs | 3 ++- gio/src/auto/buffered_input_stream.rs | 3 ++- gio/src/auto/buffered_output_stream.rs | 3 ++- gio/src/auto/charset_converter.rs | 3 ++- gio/src/auto/converter_input_stream.rs | 3 ++- gio/src/auto/converter_output_stream.rs | 3 ++- gio/src/auto/data_input_stream.rs | 3 ++- gio/src/auto/data_output_stream.rs | 3 ++- gio/src/auto/list_store.rs | 3 ++- gio/src/auto/versions.txt | 2 +- gio/sys/versions.txt | 2 +- glib/gobject-sys/versions.txt | 2 +- glib/src/auto/versions.txt | 2 +- glib/sys/versions.txt | 2 +- graphene/src/auto/versions.txt | 2 +- graphene/sys/versions.txt | 2 +- pango/src/auto/versions.txt | 2 +- pango/sys/versions.txt | 2 +- pangocairo/src/auto/versions.txt | 2 +- pangocairo/sys/versions.txt | 2 +- 22 files changed, 31 insertions(+), 22 deletions(-) diff --git a/gdk-pixbuf/src/auto/versions.txt b/gdk-pixbuf/src/auto/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/gdk-pixbuf/src/auto/versions.txt +++ b/gdk-pixbuf/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/gdk-pixbuf/sys/versions.txt b/gdk-pixbuf/sys/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/gdk-pixbuf/sys/versions.txt +++ b/gdk-pixbuf/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/gio/src/auto/application.rs b/gio/src/auto/application.rs index c51a7de4f367..a7cc6737785a 100644 --- a/gio/src/auto/application.rs +++ b/gio/src/auto/application.rs @@ -80,6 +80,7 @@ impl Default for Application { /// A [builder-pattern] type to construct [`Application`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] pub struct ApplicationBuilder { action_group: Option, application_id: Option, @@ -97,7 +98,7 @@ impl ApplicationBuilder { // rustdoc-stripper-ignore-next /// Build the [`Application`]. - #[must_use = "The builder must be built to be used"] + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> Application { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref action_group) = self.action_group { diff --git a/gio/src/auto/buffered_input_stream.rs b/gio/src/auto/buffered_input_stream.rs index 44486794b1a4..f2d97095e46f 100644 --- a/gio/src/auto/buffered_input_stream.rs +++ b/gio/src/auto/buffered_input_stream.rs @@ -75,6 +75,7 @@ impl Default for BufferedInputStream { /// A [builder-pattern] type to construct [`BufferedInputStream`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] pub struct BufferedInputStreamBuilder { buffer_size: Option, base_stream: Option, @@ -90,7 +91,7 @@ impl BufferedInputStreamBuilder { // rustdoc-stripper-ignore-next /// Build the [`BufferedInputStream`]. - #[must_use = "The builder must be built to be used"] + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> BufferedInputStream { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref buffer_size) = self.buffer_size { diff --git a/gio/src/auto/buffered_output_stream.rs b/gio/src/auto/buffered_output_stream.rs index 80ac7f6a6e85..378f176d0243 100644 --- a/gio/src/auto/buffered_output_stream.rs +++ b/gio/src/auto/buffered_output_stream.rs @@ -70,6 +70,7 @@ impl Default for BufferedOutputStream { /// A [builder-pattern] type to construct [`BufferedOutputStream`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] pub struct BufferedOutputStreamBuilder { auto_grow: Option, buffer_size: Option, @@ -86,7 +87,7 @@ impl BufferedOutputStreamBuilder { // rustdoc-stripper-ignore-next /// Build the [`BufferedOutputStream`]. - #[must_use = "The builder must be built to be used"] + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> BufferedOutputStream { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref auto_grow) = self.auto_grow { diff --git a/gio/src/auto/charset_converter.rs b/gio/src/auto/charset_converter.rs index a869e68c54ba..600d45aa09bc 100644 --- a/gio/src/auto/charset_converter.rs +++ b/gio/src/auto/charset_converter.rs @@ -123,6 +123,7 @@ impl Default for CharsetConverter { /// A [builder-pattern] type to construct [`CharsetConverter`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] pub struct CharsetConverterBuilder { from_charset: Option, to_charset: Option, @@ -138,7 +139,7 @@ impl CharsetConverterBuilder { // rustdoc-stripper-ignore-next /// Build the [`CharsetConverter`]. - #[must_use = "The builder must be built to be used"] + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> CharsetConverter { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref from_charset) = self.from_charset { diff --git a/gio/src/auto/converter_input_stream.rs b/gio/src/auto/converter_input_stream.rs index 0fcb131db9f9..d53be647cb12 100644 --- a/gio/src/auto/converter_input_stream.rs +++ b/gio/src/auto/converter_input_stream.rs @@ -60,6 +60,7 @@ impl Default for ConverterInputStream { /// A [builder-pattern] type to construct [`ConverterInputStream`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] pub struct ConverterInputStreamBuilder { converter: Option, base_stream: Option, @@ -75,7 +76,7 @@ impl ConverterInputStreamBuilder { // rustdoc-stripper-ignore-next /// Build the [`ConverterInputStream`]. - #[must_use = "The builder must be built to be used"] + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ConverterInputStream { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref converter) = self.converter { diff --git a/gio/src/auto/converter_output_stream.rs b/gio/src/auto/converter_output_stream.rs index c58ed8c4d468..d956671ad560 100644 --- a/gio/src/auto/converter_output_stream.rs +++ b/gio/src/auto/converter_output_stream.rs @@ -60,6 +60,7 @@ impl Default for ConverterOutputStream { /// A [builder-pattern] type to construct [`ConverterOutputStream`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] pub struct ConverterOutputStreamBuilder { converter: Option, base_stream: Option, @@ -75,7 +76,7 @@ impl ConverterOutputStreamBuilder { // rustdoc-stripper-ignore-next /// Build the [`ConverterOutputStream`]. - #[must_use = "The builder must be built to be used"] + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ConverterOutputStream { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref converter) = self.converter { diff --git a/gio/src/auto/data_input_stream.rs b/gio/src/auto/data_input_stream.rs index c9dc70d33eb0..e29548186013 100644 --- a/gio/src/auto/data_input_stream.rs +++ b/gio/src/auto/data_input_stream.rs @@ -65,6 +65,7 @@ impl Default for DataInputStream { /// A [builder-pattern] type to construct [`DataInputStream`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] pub struct DataInputStreamBuilder { byte_order: Option, newline_type: Option, @@ -82,7 +83,7 @@ impl DataInputStreamBuilder { // rustdoc-stripper-ignore-next /// Build the [`DataInputStream`]. - #[must_use = "The builder must be built to be used"] + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> DataInputStream { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref byte_order) = self.byte_order { diff --git a/gio/src/auto/data_output_stream.rs b/gio/src/auto/data_output_stream.rs index 3a779263b76c..dd2b9d540c00 100644 --- a/gio/src/auto/data_output_stream.rs +++ b/gio/src/auto/data_output_stream.rs @@ -61,6 +61,7 @@ impl Default for DataOutputStream { /// A [builder-pattern] type to construct [`DataOutputStream`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] pub struct DataOutputStreamBuilder { byte_order: Option, base_stream: Option, @@ -76,7 +77,7 @@ impl DataOutputStreamBuilder { // rustdoc-stripper-ignore-next /// Build the [`DataOutputStream`]. - #[must_use = "The builder must be built to be used"] + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> DataOutputStream { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref byte_order) = self.byte_order { diff --git a/gio/src/auto/list_store.rs b/gio/src/auto/list_store.rs index 329a2fc9a7fd..a85a30fb112c 100644 --- a/gio/src/auto/list_store.rs +++ b/gio/src/auto/list_store.rs @@ -101,6 +101,7 @@ impl Default for ListStore { /// A [builder-pattern] type to construct [`ListStore`] objects. /// /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] pub struct ListStoreBuilder { item_type: Option, } @@ -114,7 +115,7 @@ impl ListStoreBuilder { // rustdoc-stripper-ignore-next /// Build the [`ListStore`]. - #[must_use = "The builder must be built to be used"] + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> ListStore { let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; if let Some(ref item_type) = self.item_type { diff --git a/gio/src/auto/versions.txt b/gio/src/auto/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/gio/src/auto/versions.txt +++ b/gio/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/gio/sys/versions.txt b/gio/sys/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/gio/sys/versions.txt +++ b/gio/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/glib/gobject-sys/versions.txt b/glib/gobject-sys/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/glib/gobject-sys/versions.txt +++ b/glib/gobject-sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/glib/src/auto/versions.txt b/glib/src/auto/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/glib/src/auto/versions.txt +++ b/glib/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/glib/sys/versions.txt b/glib/sys/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/glib/sys/versions.txt +++ b/glib/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/graphene/src/auto/versions.txt b/graphene/src/auto/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/graphene/src/auto/versions.txt +++ b/graphene/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/graphene/sys/versions.txt b/graphene/sys/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/graphene/sys/versions.txt +++ b/graphene/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/pango/src/auto/versions.txt b/pango/src/auto/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/pango/src/auto/versions.txt +++ b/pango/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/pango/sys/versions.txt b/pango/sys/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/pango/sys/versions.txt +++ b/pango/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/pangocairo/src/auto/versions.txt b/pangocairo/src/auto/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/pangocairo/src/auto/versions.txt +++ b/pangocairo/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) diff --git a/pangocairo/sys/versions.txt b/pangocairo/sys/versions.txt index 719c437cce3d..b06458b9d04d 100644 --- a/pangocairo/sys/versions.txt +++ b/pangocairo/sys/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11) +Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959) from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2) From f2a1e85a780c6a7a41fac724e428f753f0b1870f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 3 Dec 2021 13:06:52 +0200 Subject: [PATCH 3/3] Add some `#[must_use]` to manually implemented builder types ... or improve their messages a bit. --- gio/src/io_extension_point.rs | 3 ++- gio/src/settings.rs | 2 +- glib/src/enums.rs | 2 ++ glib/src/gstring_builder.rs | 2 ++ glib/src/object.rs | 2 +- glib/src/subclass/signal.rs | 2 ++ 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gio/src/io_extension_point.rs b/gio/src/io_extension_point.rs index ee9858f9c0f9..d67ea72b88f0 100644 --- a/gio/src/io_extension_point.rs +++ b/gio/src/io_extension_point.rs @@ -9,7 +9,7 @@ use crate::io_extension::IOExtension; /// Builder for extension points. #[derive(Debug)] -#[must_use = "Builder doesn't do anything unless built"] +#[must_use = "The builder must be built to be used"] pub struct IOExtensionPointBuilder<'a> { name: &'a str, required_type: Option, @@ -31,6 +31,7 @@ impl<'a> IOExtensionPointBuilder<'a> { } } + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] pub fn build(self) -> IOExtensionPoint { unsafe { let ep = IOExtensionPoint::from_glib_none(ffi::g_io_extension_point_register( diff --git a/gio/src/settings.rs b/gio/src/settings.rs index b21fb2c1cee9..6439cefa7ab3 100644 --- a/gio/src/settings.rs +++ b/gio/src/settings.rs @@ -6,7 +6,7 @@ use glib::translate::{from_glib_borrow, from_glib_none, IntoGlib, ToGlibPtr}; use glib::variant::FromVariant; use glib::{BoolError, IsA, ToVariant}; -#[must_use] +#[must_use = "The builder must be built to be used"] pub struct BindingBuilder<'a> { settings: &'a Settings, key: &'a str, diff --git a/glib/src/enums.rs b/glib/src/enums.rs index 97e7a218c361..8998dfc8a3b5 100644 --- a/glib/src/enums.rs +++ b/glib/src/enums.rs @@ -675,6 +675,7 @@ impl Eq for FlagsValue {} /// ``` /// /// If setting/unsetting any value fails, `build()` returns `None`. +#[must_use = "The builder must be built to be used"] pub struct FlagsBuilder<'a>(&'a FlagsClass, Option); impl<'a> FlagsBuilder<'a> { fn new(flags_class: &FlagsClass) -> FlagsBuilder { @@ -741,6 +742,7 @@ impl<'a> FlagsBuilder<'a> { } /// Converts to the final `Value`, unless any previous setting/unsetting of flags failed. + #[must_use = "Value returned from the builder should probably be used"] pub fn build(self) -> Option { self.1 } diff --git a/glib/src/gstring_builder.rs b/glib/src/gstring_builder.rs index c09473760462..f30513835aea 100644 --- a/glib/src/gstring_builder.rs +++ b/glib/src/gstring_builder.rs @@ -13,6 +13,7 @@ use std::str; wrapper! { /// A mutable text buffer that grows automatically. #[doc(alias = "GString")] + #[must_use = "The builder must be built to be used"] pub struct GStringBuilder(Boxed); match fn { @@ -96,6 +97,7 @@ impl GStringBuilder { /// # Panics /// /// If the string builder contains invalid UTF-8 this function panics. + #[must_use = "String returned from the builder should probably be used"] pub fn into_string(self) -> crate::GString { unsafe { let s = mem::ManuallyDrop::new(self); diff --git a/glib/src/object.rs b/glib/src/object.rs index e189100ef7a6..b09304262c7e 100644 --- a/glib/src/object.rs +++ b/glib/src/object.rs @@ -3317,7 +3317,7 @@ type TransformFn = Option Option + Send + Sync + 'static>>; /// Builder for object property bindings. -#[must_use] +#[must_use = "The builder must be built to be used"] pub struct BindingBuilder<'a> { source: &'a ObjectRef, source_property: &'a str, diff --git a/glib/src/subclass/signal.rs b/glib/src/subclass/signal.rs index b433c82874d0..ecda42eaf502 100644 --- a/glib/src/subclass/signal.rs +++ b/glib/src/subclass/signal.rs @@ -13,6 +13,7 @@ use std::{fmt, num::NonZeroU32}; /// Builder for signals. #[allow(clippy::type_complexity)] +#[must_use = "The builder must be built to be used"] pub struct SignalBuilder<'a> { name: &'a str, flags: SignalFlags, @@ -442,6 +443,7 @@ impl<'a> SignalBuilder<'a> { /// /// This does not register the signal yet, which only happens as part of object type /// registration. + #[must_use = "Signal returned from the builder must be used for it to be registered"] pub fn build(self) -> Signal { let flags = if self.flags & (SignalFlags::RUN_FIRST | SignalFlags::RUN_LAST | SignalFlags::RUN_CLEANUP)