Skip to content

Commit 09eb07c

Browse files
authored
Merge pull request #399 from sdroege/builder-must-use
Update gir for new builder `#[must_use]` usage
2 parents 9048b97 + f2a1e85 commit 09eb07c

29 files changed

+42
-26
lines changed

gdk-pixbuf/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

gdk-pixbuf/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

gio/src/auto/application.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ impl Default for Application {
8080
/// A [builder-pattern] type to construct [`Application`] objects.
8181
///
8282
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
83+
#[must_use = "The builder must be built to be used"]
8384
pub struct ApplicationBuilder {
8485
action_group: Option<ActionGroup>,
8586
application_id: Option<String>,
@@ -97,7 +98,7 @@ impl ApplicationBuilder {
9798

9899
// rustdoc-stripper-ignore-next
99100
/// Build the [`Application`].
100-
#[must_use = "The builder must be built to be used"]
101+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
101102
pub fn build(self) -> Application {
102103
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
103104
if let Some(ref action_group) = self.action_group {

gio/src/auto/buffered_input_stream.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ impl Default for BufferedInputStream {
7575
/// A [builder-pattern] type to construct [`BufferedInputStream`] objects.
7676
///
7777
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
78+
#[must_use = "The builder must be built to be used"]
7879
pub struct BufferedInputStreamBuilder {
7980
buffer_size: Option<u32>,
8081
base_stream: Option<InputStream>,
@@ -90,7 +91,7 @@ impl BufferedInputStreamBuilder {
9091

9192
// rustdoc-stripper-ignore-next
9293
/// Build the [`BufferedInputStream`].
93-
#[must_use = "The builder must be built to be used"]
94+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
9495
pub fn build(self) -> BufferedInputStream {
9596
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
9697
if let Some(ref buffer_size) = self.buffer_size {

gio/src/auto/buffered_output_stream.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ impl Default for BufferedOutputStream {
7070
/// A [builder-pattern] type to construct [`BufferedOutputStream`] objects.
7171
///
7272
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
73+
#[must_use = "The builder must be built to be used"]
7374
pub struct BufferedOutputStreamBuilder {
7475
auto_grow: Option<bool>,
7576
buffer_size: Option<u32>,
@@ -86,7 +87,7 @@ impl BufferedOutputStreamBuilder {
8687

8788
// rustdoc-stripper-ignore-next
8889
/// Build the [`BufferedOutputStream`].
89-
#[must_use = "The builder must be built to be used"]
90+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
9091
pub fn build(self) -> BufferedOutputStream {
9192
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
9293
if let Some(ref auto_grow) = self.auto_grow {

gio/src/auto/charset_converter.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ impl Default for CharsetConverter {
123123
/// A [builder-pattern] type to construct [`CharsetConverter`] objects.
124124
///
125125
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
126+
#[must_use = "The builder must be built to be used"]
126127
pub struct CharsetConverterBuilder {
127128
from_charset: Option<String>,
128129
to_charset: Option<String>,
@@ -138,7 +139,7 @@ impl CharsetConverterBuilder {
138139

139140
// rustdoc-stripper-ignore-next
140141
/// Build the [`CharsetConverter`].
141-
#[must_use = "The builder must be built to be used"]
142+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
142143
pub fn build(self) -> CharsetConverter {
143144
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
144145
if let Some(ref from_charset) = self.from_charset {

gio/src/auto/converter_input_stream.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ impl Default for ConverterInputStream {
6060
/// A [builder-pattern] type to construct [`ConverterInputStream`] objects.
6161
///
6262
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
63+
#[must_use = "The builder must be built to be used"]
6364
pub struct ConverterInputStreamBuilder {
6465
converter: Option<Converter>,
6566
base_stream: Option<InputStream>,
@@ -75,7 +76,7 @@ impl ConverterInputStreamBuilder {
7576

7677
// rustdoc-stripper-ignore-next
7778
/// Build the [`ConverterInputStream`].
78-
#[must_use = "The builder must be built to be used"]
79+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
7980
pub fn build(self) -> ConverterInputStream {
8081
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
8182
if let Some(ref converter) = self.converter {

gio/src/auto/converter_output_stream.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ impl Default for ConverterOutputStream {
6060
/// A [builder-pattern] type to construct [`ConverterOutputStream`] objects.
6161
///
6262
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
63+
#[must_use = "The builder must be built to be used"]
6364
pub struct ConverterOutputStreamBuilder {
6465
converter: Option<Converter>,
6566
base_stream: Option<OutputStream>,
@@ -75,7 +76,7 @@ impl ConverterOutputStreamBuilder {
7576

7677
// rustdoc-stripper-ignore-next
7778
/// Build the [`ConverterOutputStream`].
78-
#[must_use = "The builder must be built to be used"]
79+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
7980
pub fn build(self) -> ConverterOutputStream {
8081
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
8182
if let Some(ref converter) = self.converter {

gio/src/auto/data_input_stream.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ impl Default for DataInputStream {
6565
/// A [builder-pattern] type to construct [`DataInputStream`] objects.
6666
///
6767
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
68+
#[must_use = "The builder must be built to be used"]
6869
pub struct DataInputStreamBuilder {
6970
byte_order: Option<DataStreamByteOrder>,
7071
newline_type: Option<DataStreamNewlineType>,
@@ -82,7 +83,7 @@ impl DataInputStreamBuilder {
8283

8384
// rustdoc-stripper-ignore-next
8485
/// Build the [`DataInputStream`].
85-
#[must_use = "The builder must be built to be used"]
86+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
8687
pub fn build(self) -> DataInputStream {
8788
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
8889
if let Some(ref byte_order) = self.byte_order {

gio/src/auto/data_output_stream.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ impl Default for DataOutputStream {
6161
/// A [builder-pattern] type to construct [`DataOutputStream`] objects.
6262
///
6363
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
64+
#[must_use = "The builder must be built to be used"]
6465
pub struct DataOutputStreamBuilder {
6566
byte_order: Option<DataStreamByteOrder>,
6667
base_stream: Option<OutputStream>,
@@ -76,7 +77,7 @@ impl DataOutputStreamBuilder {
7677

7778
// rustdoc-stripper-ignore-next
7879
/// Build the [`DataOutputStream`].
79-
#[must_use = "The builder must be built to be used"]
80+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
8081
pub fn build(self) -> DataOutputStream {
8182
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
8283
if let Some(ref byte_order) = self.byte_order {

gio/src/auto/list_store.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ impl Default for ListStore {
101101
/// A [builder-pattern] type to construct [`ListStore`] objects.
102102
///
103103
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
104+
#[must_use = "The builder must be built to be used"]
104105
pub struct ListStoreBuilder {
105106
item_type: Option<glib::types::Type>,
106107
}
@@ -114,7 +115,7 @@ impl ListStoreBuilder {
114115

115116
// rustdoc-stripper-ignore-next
116117
/// Build the [`ListStore`].
117-
#[must_use = "The builder must be built to be used"]
118+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
118119
pub fn build(self) -> ListStore {
119120
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
120121
if let Some(ref item_type) = self.item_type {

gio/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

gio/src/io_extension_point.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::io_extension::IOExtension;
99

1010
/// Builder for extension points.
1111
#[derive(Debug)]
12-
#[must_use = "Builder doesn't do anything unless built"]
12+
#[must_use = "The builder must be built to be used"]
1313
pub struct IOExtensionPointBuilder<'a> {
1414
name: &'a str,
1515
required_type: Option<Type>,
@@ -31,6 +31,7 @@ impl<'a> IOExtensionPointBuilder<'a> {
3131
}
3232
}
3333

34+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
3435
pub fn build(self) -> IOExtensionPoint {
3536
unsafe {
3637
let ep = IOExtensionPoint::from_glib_none(ffi::g_io_extension_point_register(

gio/src/settings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use glib::translate::{from_glib_borrow, from_glib_none, IntoGlib, ToGlibPtr};
66
use glib::variant::FromVariant;
77
use glib::{BoolError, IsA, ToVariant};
88

9-
#[must_use]
9+
#[must_use = "The builder must be built to be used"]
1010
pub struct BindingBuilder<'a> {
1111
settings: &'a Settings,
1212
key: &'a str,

gio/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

glib/gobject-sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

glib/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

glib/src/enums.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ impl Eq for FlagsValue {}
675675
/// ```
676676
///
677677
/// If setting/unsetting any value fails, `build()` returns `None`.
678+
#[must_use = "The builder must be built to be used"]
678679
pub struct FlagsBuilder<'a>(&'a FlagsClass, Option<Value>);
679680
impl<'a> FlagsBuilder<'a> {
680681
fn new(flags_class: &FlagsClass) -> FlagsBuilder {
@@ -741,6 +742,7 @@ impl<'a> FlagsBuilder<'a> {
741742
}
742743

743744
/// Converts to the final `Value`, unless any previous setting/unsetting of flags failed.
745+
#[must_use = "Value returned from the builder should probably be used"]
744746
pub fn build(self) -> Option<Value> {
745747
self.1
746748
}

glib/src/gstring_builder.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::str;
1313
wrapper! {
1414
/// A mutable text buffer that grows automatically.
1515
#[doc(alias = "GString")]
16+
#[must_use = "The builder must be built to be used"]
1617
pub struct GStringBuilder(Boxed<ffi::GString>);
1718

1819
match fn {
@@ -96,6 +97,7 @@ impl GStringBuilder {
9697
/// # Panics
9798
///
9899
/// If the string builder contains invalid UTF-8 this function panics.
100+
#[must_use = "String returned from the builder should probably be used"]
99101
pub fn into_string(self) -> crate::GString {
100102
unsafe {
101103
let s = mem::ManuallyDrop::new(self);

glib/src/object.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3317,7 +3317,7 @@ type TransformFn =
33173317
Option<Box<dyn Fn(&crate::Binding, &Value) -> Option<Value> + Send + Sync + 'static>>;
33183318

33193319
/// Builder for object property bindings.
3320-
#[must_use]
3320+
#[must_use = "The builder must be built to be used"]
33213321
pub struct BindingBuilder<'a> {
33223322
source: &'a ObjectRef,
33233323
source_property: &'a str,

glib/src/subclass/signal.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::{fmt, num::NonZeroU32};
1313

1414
/// Builder for signals.
1515
#[allow(clippy::type_complexity)]
16+
#[must_use = "The builder must be built to be used"]
1617
pub struct SignalBuilder<'a> {
1718
name: &'a str,
1819
flags: SignalFlags,
@@ -442,6 +443,7 @@ impl<'a> SignalBuilder<'a> {
442443
///
443444
/// This does not register the signal yet, which only happens as part of object type
444445
/// registration.
446+
#[must_use = "Signal returned from the builder must be used for it to be registered"]
445447
pub fn build(self) -> Signal {
446448
let flags = if self.flags
447449
& (SignalFlags::RUN_FIRST | SignalFlags::RUN_LAST | SignalFlags::RUN_CLEANUP)

glib/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

graphene/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

graphene/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

pango/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

pango/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

pangocairo/src/auto/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

pangocairo/sys/versions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Generated by gir (https://github.com/gtk-rs/gir @ 02eb99133f11)
1+
Generated by gir (https://github.com/gtk-rs/gir @ 50377b886959)
22
from gir-files (https://github.com/gtk-rs/gir-files @ 46f24acbe4c2)

0 commit comments

Comments
 (0)