summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/screenshot/src/main.rs5
-rw-r--r--runtime/src/command.rs6
2 files changed, 4 insertions, 7 deletions
diff --git a/examples/screenshot/src/main.rs b/examples/screenshot/src/main.rs
index ab0a2ae3..f781a401 100644
--- a/examples/screenshot/src/main.rs
+++ b/examples/screenshot/src/main.rs
@@ -298,10 +298,7 @@ fn numeric_input(
) -> Element<'_, Option<u32>> {
text_input(
placeholder,
- &value
- .as_ref()
- .map(ToString::to_string)
- .unwrap_or_else(String::new),
+ &value.as_ref().map(ToString::to_string).unwrap_or_default(),
)
.on_input(move |text| {
if text.is_empty() {
diff --git a/runtime/src/command.rs b/runtime/src/command.rs
index cd4c51ff..b74097bd 100644
--- a/runtime/src/command.rs
+++ b/runtime/src/command.rs
@@ -40,9 +40,9 @@ impl<T> Command<T> {
/// Creates a [`Command`] that performs the action of the given future.
pub fn perform<A>(
- future: impl Future<Output = T> + 'static + MaybeSend,
- f: impl FnOnce(T) -> A + 'static + MaybeSend,
- ) -> Command<A> {
+ future: impl Future<Output = A> + 'static + MaybeSend,
+ f: impl FnOnce(A) -> T + 'static + MaybeSend,
+ ) -> Command<T> {
use iced_futures::futures::FutureExt;
Command::single(Action::Future(Box::pin(future.map(f))))