---
title: "Comment by Christian Foucher on \"ESP32 Standard Library Embedded Rust: GPIO Control\" | Hashnode"
description: "Another suggestion, you can remove all the &quot;return&quot; key words of the button_pressed function (don&#39;t forget to remove also semicolon). It is more i"
url: "https://hashnode.com/posts/esp32-standard-library-embedded-rust-gpio-control/64afe421c3220ca4300ee7a2/comment/64ba889a2e3477ebf613499c"
---

[Discussion](https://hashnode.com/posts/esp32-standard-library-embedded-rust-gpio-control/64afe421c3220ca4300ee7a2)

Comment [ESP32 Standard Library Embedded Rust: GPIO Control](https://hashnode.com/posts/esp32-standard-library-embedded-rust-gpio-control/64afe421c3220ca4300ee7a2)

[Christian Foucher](https://hashnode.com/@Valda60)

[Jul 21, 2023](https://hashnode.com/posts/esp32-standard-library-embedded-rust-gpio-control/64afe421c3220ca4300ee7a2/comment/64ba889a2e3477ebf613499c)

Another suggestion, you can remove all the "return" key words of the button\_pressed function (don't forget to remove also semicolon). It is more idiomatic Rust, but also less readable for the new comer.

fn button_pressed(but: &PinDriver<'_, Gpio3, Input>, del: &u32) -> u32 { // Check if Button has been pressed // If not pressed, return the delay value unchanged if but.is\_low() { // if the value of the delay passed is less of equal to 50 then reset it to initial value // else subtract 50 from the passed delay println!("Button Pressed!"); if del <= &50\_u32 { 200\_u32 } else { 50\_u32 } } else { \*del } }
