diff options
author | 2023-07-13 14:30:54 +0100 | |
---|---|---|
committer | 2023-07-26 21:59:42 +0200 | |
commit | 7fe3389cf10d5ca3752127df30dafbd6965a0fe9 (patch) | |
tree | 4a349c8df93b0d23a45b2b501ac4069599aa1dd2 /widget/src/combo_box.rs | |
parent | 470e13c806f4239ca3f2e90e9c0a794a81e354d8 (diff) | |
download | iced-7fe3389cf10d5ca3752127df30dafbd6965a0fe9.tar.gz iced-7fe3389cf10d5ca3752127df30dafbd6965a0fe9.tar.bz2 iced-7fe3389cf10d5ca3752127df30dafbd6965a0fe9.zip |
Swap unwrap_or_else to unwrap_or_default
Diffstat (limited to 'widget/src/combo_box.rs')
-rw-r--r-- | widget/src/combo_box.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/widget/src/combo_box.rs b/widget/src/combo_box.rs index 262f83a8..23839980 100644 --- a/widget/src/combo_box.rs +++ b/widget/src/combo_box.rs @@ -58,7 +58,7 @@ where let text_input = TextInput::new(placeholder, &state.value()) .on_input(TextInputEvent::TextChanged); - let selection = selection.map(T::to_string).unwrap_or_else(String::new); + let selection = selection.map(T::to_string).unwrap_or_default(); Self { state, @@ -204,7 +204,7 @@ where /// Creates a new [`State`] for a [`ComboBox`] with the given list of options /// and selected value. pub fn with_selection(options: Vec<T>, selection: Option<&T>) -> Self { - let value = selection.map(T::to_string).unwrap_or_else(String::new); + let value = selection.map(T::to_string).unwrap_or_default(); // Pre-build "matcher" strings ahead of time so that search is fast let option_matchers = build_matchers(&options); |