Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit 21b6a65

Browse files
committed
gtk: Add #[must_use] attribute to manually implemented builders
1 parent 59665d4 commit 21b6a65

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

gtk/src/image.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ impl Image {
6969
#[derive(Clone, Default)]
7070
// rustdoc-stripper-ignore-next
7171
/// A builder for generating a [`Image`].
72+
#[must_use = "The builder must be built to be used"]
7273
pub struct ImageBuilder {
7374
file: Option<String>,
7475
gicon: Option<gio::Icon>,
@@ -125,7 +126,7 @@ impl ImageBuilder {
125126

126127
// rustdoc-stripper-ignore-next
127128
/// Build the [`Image`].
128-
#[must_use = "The builder must be built to be used"]
129+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
129130
pub fn build(self) -> Image {
130131
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
131132
if let Some(ref file) = self.file {

gtk/src/stack_switcher.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ impl StackSwitcher {
9494
#[derive(Clone, Default)]
9595
// rustdoc-stripper-ignore-next
9696
/// A builder for generating a [`StackSwitcher`].
97+
#[must_use = "The builder must be built to be used"]
9798
pub struct StackSwitcherBuilder {
9899
#[cfg(any(feature = "v3_20", feature = "dox"))]
99100
#[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
@@ -151,7 +152,7 @@ impl StackSwitcherBuilder {
151152

152153
// rustdoc-stripper-ignore-next
153154
/// Build the [`StackSwitcher`].
154-
#[must_use = "The builder must be built to be used"]
155+
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
155156
pub fn build(self) -> StackSwitcher {
156157
let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
157158
#[cfg(any(feature = "v3_20", feature = "dox"))]

0 commit comments

Comments
 (0)