diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index 800254ed..0928cf30 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -528,9 +528,10 @@ impl<'a> Step { .push(Language::all().iter().cloned().fold( Column::new().padding(10).spacing(20), |choices, language| { + let label: &str = language.into(); choices.push(Radio::new( language, - language.into(), + label, selection, StepMessage::LanguageSelected, )) diff --git a/native/src/widget/radio.rs b/native/src/widget/radio.rs index 8fb3d0cc..bc23c116 100644 --- a/native/src/widget/radio.rs +++ b/native/src/widget/radio.rs @@ -53,7 +53,12 @@ impl Radio { /// receives the value of the radio and must produce a `Message`. /// /// [`Radio`]: struct.Radio.html - pub fn new(value: V, label: &str, selected: Option, f: F) -> Self + pub fn new( + value: V, + label: impl Into, + selected: Option, + f: F, + ) -> Self where V: Eq + Copy, F: 'static + Fn(V) -> Message, @@ -61,7 +66,7 @@ impl Radio { Radio { is_selected: Some(value) == selected, on_click: f(value), - label: String::from(label), + label: label.into(), style: Renderer::Style::default(), } }