diff --git a/widget/src/button.rs b/widget/src/button.rs index d1fa93027a..a2f9945c19 100644 --- a/widget/src/button.rs +++ b/widget/src/button.rs @@ -315,8 +315,7 @@ where } Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) | Event::Touch(touch::Event::FingerLifted { .. }) => { - if let Some(on_press) = self.on_press.as_ref().map(OnPress::get) - { + if let Some(on_press) = &self.on_press { let state = tree.state.downcast_mut::(); if state.is_pressed { @@ -325,7 +324,7 @@ where let bounds = layout.bounds(); if cursor.is_over(bounds) { - shell.publish(on_press); + shell.publish(on_press.get()); } shell.capture_event();