Skip to content

Update gir for new builder #[must_use] usage #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion gdk-pixbuf/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 2 additions & 1 deletion gio/src/auto/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ActionGroup>,
application_id: Option<String>,
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion gio/src/auto/buffered_input_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u32>,
base_stream: Option<InputStream>,
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion gio/src/auto/buffered_output_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>,
buffer_size: Option<u32>,
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion gio/src/auto/charset_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
to_charset: Option<String>,
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion gio/src/auto/converter_input_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Converter>,
base_stream: Option<InputStream>,
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion gio/src/auto/converter_output_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Converter>,
base_stream: Option<OutputStream>,
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion gio/src/auto/data_input_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DataStreamByteOrder>,
newline_type: Option<DataStreamNewlineType>,
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion gio/src/auto/data_output_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DataStreamByteOrder>,
base_stream: Option<OutputStream>,
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion gio/src/auto/list_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<glib::types::Type>,
}
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion gio/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 2 additions & 1 deletion gio/src/io_extension_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Type>,
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion gio/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion gio/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion glib/gobject-sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion glib/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions glib/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Value>);
impl<'a> FlagsBuilder<'a> {
fn new(flags_class: &FlagsClass) -> FlagsBuilder {
Expand Down Expand Up @@ -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<Value> {
self.1
}
Expand Down
2 changes: 2 additions & 0 deletions glib/src/gstring_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ffi::GString>);

match fn {
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion glib/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3317,7 +3317,7 @@ type TransformFn =
Option<Box<dyn Fn(&crate::Binding, &Value) -> Option<Value> + 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,
Expand Down
2 changes: 2 additions & 0 deletions glib/src/subclass/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion glib/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion graphene/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion graphene/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion pango/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion pango/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion pangocairo/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion pangocairo/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -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)