diff options
author | 2023-09-20 16:26:43 +0200 | |
---|---|---|
committer | 2023-09-20 16:26:43 +0200 | |
commit | b27762554627b8e89f2b840b1a8a512e22d4cd87 (patch) | |
tree | 4099870d14980fb2651dc50786639ca704a55074 | |
parent | 76873921af3cd04ac0cbed01ebbd66936454dbe3 (diff) | |
download | iced-b27762554627b8e89f2b840b1a8a512e22d4cd87.tar.gz iced-b27762554627b8e89f2b840b1a8a512e22d4cd87.tar.bz2 iced-b27762554627b8e89f2b840b1a8a512e22d4cd87.zip |
Revert "Chore: Apply clippy map transformations"
This reverts commit c997aad85d7ee6e77085e50e5e599002549d228f.
-rw-r--r-- | core/src/mouse/click.rs | 4 | ||||
-rw-r--r-- | examples/integration/src/main.rs | 6 | ||||
-rw-r--r-- | examples/screenshot/src/main.rs | 5 | ||||
-rw-r--r-- | wgpu/src/image/vector.rs | 2 | ||||
-rw-r--r-- | wgpu/src/triangle.rs | 2 | ||||
-rw-r--r-- | winit/src/application/state.rs | 3 | ||||
-rw-r--r-- | winit/src/clipboard.rs | 3 |
7 files changed, 15 insertions, 10 deletions
diff --git a/core/src/mouse/click.rs b/core/src/mouse/click.rs index 53354098..9cc44a71 100644 --- a/core/src/mouse/click.rs +++ b/core/src/mouse/click.rs @@ -69,6 +69,8 @@ impl Click { }; self.position == new_position - && duration.is_some_and(|duration| duration.as_millis() <= 300) + && duration + .map(|duration| duration.as_millis() <= 300) + .unwrap_or(false) } } diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 4415fefa..c26d52fe 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -200,10 +200,8 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> { viewport.scale_factor(), ) }) - .map_or( - mouse::Cursor::Unavailable, - mouse::Cursor::Available, - ), + .map(mouse::Cursor::Available) + .unwrap_or(mouse::Cursor::Unavailable), &mut renderer, &Theme::Dark, &renderer::Style { diff --git a/examples/screenshot/src/main.rs b/examples/screenshot/src/main.rs index fa06d3e9..ab0a2ae3 100644 --- a/examples/screenshot/src/main.rs +++ b/examples/screenshot/src/main.rs @@ -298,7 +298,10 @@ fn numeric_input( ) -> Element<'_, Option<u32>> { text_input( placeholder, - &value.as_ref().map_or_else(String::new, ToString::to_string), + &value + .as_ref() + .map(ToString::to_string) + .unwrap_or_else(String::new), ) .on_input(move |text| { if text.is_empty() { diff --git a/wgpu/src/image/vector.rs b/wgpu/src/image/vector.rs index e8baae4f..6582bb82 100644 --- a/wgpu/src/image/vector.rs +++ b/wgpu/src/image/vector.rs @@ -56,7 +56,7 @@ impl Cache { .ok() }); - tree.map_or(Svg::NotFound, Svg::Loaded) + tree.map(Svg::Loaded).unwrap_or(Svg::NotFound) } svg::Data::Bytes(bytes) => { match usvg::Tree::from_data(bytes, &usvg::Options::default()) { diff --git a/wgpu/src/triangle.rs b/wgpu/src/triangle.rs index f8014ceb..c55b93bf 100644 --- a/wgpu/src/triangle.rs +++ b/wgpu/src/triangle.rs @@ -349,7 +349,7 @@ fn multisample_state( antialiasing: Option<Antialiasing>, ) -> wgpu::MultisampleState { wgpu::MultisampleState { - count: antialiasing.map_or(1, Antialiasing::sample_count), + count: antialiasing.map(|a| a.sample_count()).unwrap_or(1), mask: !0, alpha_to_coverage_enabled: false, } diff --git a/winit/src/application/state.rs b/winit/src/application/state.rs index 9d1d5dcf..e655529a 100644 --- a/winit/src/application/state.rs +++ b/winit/src/application/state.rs @@ -97,7 +97,8 @@ where self.viewport.scale_factor(), ) }) - .map_or(mouse::Cursor::Unavailable, mouse::Cursor::Available) + .map(mouse::Cursor::Available) + .unwrap_or(mouse::Cursor::Unavailable) } /// Returns the current keyboard modifiers of the [`State`]. diff --git a/winit/src/clipboard.rs b/winit/src/clipboard.rs index 0a09c255..f7a32868 100644 --- a/winit/src/clipboard.rs +++ b/winit/src/clipboard.rs @@ -17,7 +17,8 @@ impl Clipboard { pub fn connect(window: &winit::window::Window) -> Clipboard { let state = window_clipboard::Clipboard::connect(window) .ok() - .map_or(State::Unavailable, State::Connected); + .map(State::Connected) + .unwrap_or(State::Unavailable); Clipboard { state } } |