Skip to content

Commit

Permalink
Revert "Chore: Apply clippy map transformations"
Browse files Browse the repository at this point in the history
This reverts commit c997aad.
  • Loading branch information
hecrj committed Sep 20, 2023
1 parent 7687392 commit b277625
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
4 changes: 3 additions & 1 deletion core/src/mouse/click.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
6 changes: 2 additions & 4 deletions examples/integration/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion examples/screenshot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion wgpu/src/image/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion wgpu/src/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
3 changes: 2 additions & 1 deletion winit/src/application/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`].
Expand Down
3 changes: 2 additions & 1 deletion winit/src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
Expand Down

0 comments on commit b277625

Please sign in to comment.