improv(segmented-button): set icons with impl Into<Icon>

This commit is contained in:
Michael Aaron Murphy 2024-05-20 00:59:40 +02:00
parent 31ea71deef
commit 16c1265535
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
2 changed files with 4 additions and 4 deletions

View file

@ -103,8 +103,8 @@ where
/// .build()
/// ```
#[allow(clippy::must_use_candidate, clippy::return_self_not_must_use)]
pub fn icon(mut self, icon: Icon) -> Self {
self.model.0.icon_set(self.id, icon);
pub fn icon(mut self, icon: impl Into<Icon>) -> Self {
self.model.0.icon_set(self.id, icon.into());
self
}

View file

@ -89,8 +89,8 @@ where
/// model.insert().text("Item A").icon(IconSource::from("icon-a"));
/// ```
#[allow(clippy::must_use_candidate, clippy::return_self_not_must_use)]
pub fn icon(self, icon: Icon) -> Self {
self.model.icon_set(self.id, icon);
pub fn icon(self, icon: impl Into<Icon>) -> Self {
self.model.icon_set(self.id, icon.into());
self
}