summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-10-04 11:53:03 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-10-04 11:53:03 +0200
commit8c74464b0d608fb04a1c921b2cbb36b8bc6fc9b8 (patch)
tree40093c0f59136426a04effa417f74bc64359c09b
parentce2c795bdaca5709fa338f42b9f1c230372bbbbf (diff)
downloadiced-8c74464b0d608fb04a1c921b2cbb36b8bc6fc9b8.tar.gz
iced-8c74464b0d608fb04a1c921b2cbb36b8bc6fc9b8.tar.bz2
iced-8c74464b0d608fb04a1c921b2cbb36b8bc6fc9b8.zip
Fix `clippy` lints
-rw-r--r--examples/game_of_life/src/main.rs25
-rw-r--r--examples/multitouch/src/main.rs11
2 files changed, 15 insertions, 21 deletions
diff --git a/examples/game_of_life/src/main.rs b/examples/game_of_life/src/main.rs
index 971ad4d7..2a8b3721 100644
--- a/examples/game_of_life/src/main.rs
+++ b/examples/game_of_life/src/main.rs
@@ -424,22 +424,19 @@ mod grid {
};
match event {
- Event::Touch(touch_event) => match touch_event {
- touch::Event::FingerMoved { .. } => {
- let message = {
- *interaction = if is_populated {
- Interaction::Erasing
- } else {
- Interaction::Drawing
- };
-
- populate.or(unpopulate)
+ Event::Touch(touch::Event::FingerMoved { .. }) => {
+ let message = {
+ *interaction = if is_populated {
+ Interaction::Erasing
+ } else {
+ Interaction::Drawing
};
- (event::Status::Captured, message)
- }
- _ => (event::Status::Ignored, None),
- },
+ populate.or(unpopulate)
+ };
+
+ (event::Status::Captured, message)
+ }
Event::Mouse(mouse_event) => match mouse_event {
mouse::Event::ButtonPressed(button) => {
let message = match button {
diff --git a/examples/multitouch/src/main.rs b/examples/multitouch/src/main.rs
index 5ac0e58d..0345ceb7 100644
--- a/examples/multitouch/src/main.rs
+++ b/examples/multitouch/src/main.rs
@@ -70,7 +70,7 @@ impl Application for Multitouch {
fn update(&mut self, message: Message) -> Command<Message> {
match message {
Message::FingerPressed { id, position } => {
- self.state.fingers.insert(id, position.clone());
+ self.state.fingers.insert(id, position);
self.state.cache.clear();
}
Message::FingerLifted { id } => {
@@ -94,7 +94,7 @@ impl Application for Multitouch {
}
}
-impl<'a> canvas::Program<Message> for State {
+impl canvas::Program<Message> for State {
type State = ();
fn update(
@@ -134,11 +134,8 @@ impl<'a> canvas::Program<Message> for State {
}
// Collect tuples of (id, point);
- let mut zones: Vec<(u64, Point)> = self
- .fingers
- .iter()
- .map(|(id, pt)| (id.0, pt.clone()))
- .collect();
+ let mut zones: Vec<(u64, Point)> =
+ self.fingers.iter().map(|(id, pt)| (id.0, *pt)).collect();
// Sort by ID
zones.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap());