Skip to content

Commit

Permalink
Sprinkle some #[must_use] attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
rossmacarthur committed Jan 15, 2022
1 parent c149c11 commit 6305c51
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,14 @@ macro_rules! setter {
setter! { $name, Option<String<'a>> }
};
($name:ident, Option<$ty:ty>) => {
#[must_use]
pub fn $name(mut self, value: impl Into<$ty>) -> Self {
self.$name = Some(value.into());
self
}
};
($name:ident, $ty:ty) => {
#[must_use]
pub fn $name(mut self, value: impl Into<$ty>) -> Self {
self.$name = value.into();
self
Expand Down Expand Up @@ -340,13 +342,15 @@ impl<'a> Item<'a> {
setter! { text, Option<Text<'a>> }
setter! { quicklook_url }

#[must_use]
pub fn modifier(mut self, key: ModifierKey, data: ModifierData<'a>) -> Self {
self.modifiers.insert(key, data);
self
}
}

impl<'a> Output<'a> {
#[must_use]
pub fn items<I>(mut self, iter: I) -> Self
where
I: IntoIterator<Item = Item<'a>>,
Expand Down

0 comments on commit 6305c51

Please sign in to comment.