diff options
author | 2023-09-20 05:30:08 +0200 | |
---|---|---|
committer | 2023-09-20 05:30:08 +0200 | |
commit | f8f1a8634402a5eb4275ff0814d03a3104fea65a (patch) | |
tree | 5308dbe0dbdae527ac704dddbd64b0cbfbc29579 | |
parent | 1019d1e518d8ffe760142ccd5ff33d077434c8b9 (diff) | |
download | iced-f8f1a8634402a5eb4275ff0814d03a3104fea65a.tar.gz iced-f8f1a8634402a5eb4275ff0814d03a3104fea65a.tar.bz2 iced-f8f1a8634402a5eb4275ff0814d03a3104fea65a.zip |
Fix `clippy::manual_let_else`
-rw-r--r-- | .cargo/config.toml | 8 | ||||
-rw-r--r-- | examples/bezier_tool/src/main.rs | 9 | ||||
-rw-r--r-- | examples/game_of_life/src/main.rs | 9 | ||||
-rw-r--r-- | examples/integration/src/main.rs | 2 | ||||
-rw-r--r-- | examples/integration/src/scene.rs | 1 | ||||
-rw-r--r-- | examples/sierpinski_triangle/src/main.rs | 5 | ||||
-rw-r--r-- | examples/websocket/src/echo/server.rs | 5 |
7 files changed, 15 insertions, 24 deletions
diff --git a/.cargo/config.toml b/.cargo/config.toml index d49e034f..2c6b20b6 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -7,7 +7,8 @@ clippy --workspace --no-deps -- \ -D clippy::default_trait_access \ -D clippy::match-wildcard-for-single-variants \ -D clippy::redundant-closure-for-method-calls \ - -D clippy::filter_map_next + -D clippy::filter_map_next \ + -D clippy::manual_let_else """ nitpick = """ @@ -38,5 +39,8 @@ clippy --workspace --no-deps -- \ -A clippy::single_match_else \ -A clippy::unreadable_literal \ -A clippy::explicit_deref_methods \ - -A clippy::map_unwrap_or + -A clippy::map_unwrap_or \ + -A clippy::unnested_or_patterns \ + -A clippy::similar_names \ + -A clippy::unused_self """ diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index 9e4bc49c..56cb23ba 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -100,12 +100,9 @@ mod bezier { bounds: Rectangle, cursor: mouse::Cursor, ) -> (event::Status, Option<Curve>) { - let cursor_position = - if let Some(position) = cursor.position_in(bounds) { - position - } else { - return (event::Status::Ignored, None); - }; + let Some(cursor_position) = cursor.position_in(bounds) else { + return (event::Status::Ignored, None); + }; match event { Event::Mouse(mouse_event) => { diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs index c774e769..96840143 100644 --- a/examples/game_of_life/src/main.rs +++ b/examples/game_of_life/src/main.rs @@ -406,12 +406,9 @@ mod grid { *interaction = Interaction::None; } - let cursor_position = - if let Some(position) = cursor.position_in(bounds) { - position - } else { - return (event::Status::Ignored, None); - }; + let Some(cursor_position) = cursor.position_in(bounds) else { + return (event::Status::Ignored, None); + }; let cell = Cell::at(self.project(cursor_position, bounds.size())); let is_populated = self.state.contains(&cell); diff --git a/examples/integration/src/main.rs b/examples/integration/src/main.rs index 243297b2..4415fefa 100644 --- a/examples/integration/src/main.rs +++ b/examples/integration/src/main.rs @@ -256,7 +256,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> { { // We clear the frame - let mut render_pass = scene.clear( + let mut render_pass = Scene::clear( &view, &mut encoder, program.background_color(), diff --git a/examples/integration/src/scene.rs b/examples/integration/src/scene.rs index 90c7efbf..01808f40 100644 --- a/examples/integration/src/scene.rs +++ b/examples/integration/src/scene.rs @@ -16,7 +16,6 @@ impl Scene { } pub fn clear<'a>( - &self, target: &'a wgpu::TextureView, encoder: &'a mut wgpu::CommandEncoder, background_color: Color, diff --git a/examples/sierpinski_triangle/src/main.rs b/examples/sierpinski_triangle/src/main.rs index 885d3c63..ef935c33 100644 --- a/examples/sierpinski_triangle/src/main.rs +++ b/examples/sierpinski_triangle/src/main.rs @@ -108,10 +108,7 @@ impl canvas::Program<Message> for SierpinskiGraph { bounds: Rectangle, cursor: mouse::Cursor, ) -> (event::Status, Option<Message>) { - let cursor_position = if let Some(position) = cursor.position_in(bounds) - { - position - } else { + let Some(cursor_position) = cursor.position_in(bounds) else { return (event::Status::Ignored, None); }; diff --git a/examples/websocket/src/echo/server.rs b/examples/websocket/src/echo/server.rs index 168a635e..a696a7a4 100644 --- a/examples/websocket/src/echo/server.rs +++ b/examples/websocket/src/echo/server.rs @@ -47,10 +47,7 @@ async fn user_connected(ws: WebSocket) { }); while let Some(result) = user_ws_rx.next().await { - let msg = match result { - Ok(msg) => msg, - Err(_) => break, - }; + let Ok(msg) = result else { break }; let _ = tx.send(msg).await; } |