From c997aad85d7ee6e77085e50e5e599002549d228f Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Tue, 19 Sep 2023 01:46:46 -0400 Subject: Chore: Apply clippy map transformations Convert `.map().unwrap_or()` to `.map_or()` and similar transformations. --- examples/integration/src/main.rs | 6 ++++-- examples/screenshot/src/main.rs | 5 +---- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 7945bd20..243297b2 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -200,8 +200,10 @@ pub fn main() -> Result<(), Box> { viewport.scale_factor(), ) }) - .map(mouse::Cursor::Available) - .unwrap_or(mouse::Cursor::Unavailable), + .map_or( + mouse::Cursor::Unavailable, + mouse::Cursor::Available, + ), &mut renderer, &Theme::Dark, &renderer::Style { diff --git a/examples/screenshot/src/main.rs b/examples/screenshot/src/main.rs index 68c9d031..4dc1b051 100644 --- a/examples/screenshot/src/main.rs +++ b/examples/screenshot/src/main.rs @@ -293,10 +293,7 @@ fn numeric_input( ) -> Element<'_, Option> { text_input( placeholder, - &value - .as_ref() - .map(ToString::to_string) - .unwrap_or_else(String::new), + &value.as_ref().map_or_else(String::new, ToString::to_string), ) .on_input(move |text| { if text.is_empty() { -- cgit