Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: cleanup app.rs #36

Merged
merged 6 commits into from
Nov 19, 2022
Merged

refactor: cleanup app.rs #36

merged 6 commits into from
Nov 19, 2022

Conversation

nozwock
Copy link
Contributor

@nozwock nozwock commented Nov 14, 2022

Refactor

  • Remove explicitly stated data types where appropriate
  • Replace complex code in favor of unwrap_or_default() for parsing of String to u64/f64
  • Use mutable variable instead of its clone

src/app.rs Outdated Show resolved Hide resolved
@nozwock nozwock changed the title refactor: reduce number of clones() calls refactor: reduce number of clone() calls Nov 14, 2022
@MrTanoshii MrTanoshii added the enhancement New feature or request label Nov 19, 2022
Copy link
Owner

@MrTanoshii MrTanoshii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parsing functions can be removed in favor of directly using parse().unwrap_or_default()

There's interval: u64 on L494 that can also be cleaned up of its data type

src/app.rs Outdated Show resolved Hide resolved
@MrTanoshii
Copy link
Owner

Contributes to #3

@nozwock nozwock changed the title refactor: reduce number of clone() calls refactor: cleanup app.rs Nov 19, 2022
Repository owner deleted a comment from nozwock Nov 19, 2022
@nozwock
Copy link
Contributor Author

nozwock commented Nov 19, 2022

There's interval: u64 on L494 that can also be cleaned up of its data type

I was thinking of this rather

        let interval: u64 = (hr * 3600000) + (min * 60000) + (sec * 1000) + ms;

Let's leave that u64 out just for being lil explicit?

@MrTanoshii
Copy link
Owner

There's interval: u64 on L494 that can also be cleaned up of its data type

I was thinking of this rather

        let interval: u64 = (hr * 3600000) + (min * 60000) + (sec * 1000) + ms;

Let's leave that u64 out just for being lil explicit?

yeah that works too

@nozwock
Copy link
Contributor Author

nozwock commented Nov 19, 2022

yeah that works too

Done

@MrTanoshii MrTanoshii merged commit de6b155 into MrTanoshii:main Nov 19, 2022
@MrTanoshii
Copy link
Owner

Thanks!

@nozwock nozwock deleted the refactor branch November 19, 2022 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants