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

Code Improvements #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Code Improvements #1

wants to merge 5 commits into from

Conversation

tcyrus
Copy link

@tcyrus tcyrus commented Mar 7, 2020

  • Use trim_start_matches instead of while loop
  • Use match statements in src/flash.rc
  • Replace writeln!(stderr(), ...) with eprintln!(...)

@tcyrus
Copy link
Author

tcyrus commented Feb 26, 2021

@jackpot51 Sorry for poking you, but I'm currently going through old forks and addressing stale PR's.
Is there anything preventing this PR from being merged?

@jackpot51
Copy link
Member

Please try to compile this.

@tcyrus
Copy link
Author

tcyrus commented Feb 27, 2021

Sorry about that. I believe that I've fixed the cargo build issues.

}
version
let version = unsafe { self.get_str(b"VER:") };
String::from(version.trim_start_matches(' '))
Copy link
Member

Choose a reason for hiding this comment

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

This allocates twice, compared to the original code which only allocates a string once, then shifts the bytes around as necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants