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

Misc tidy up #77

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

Misc tidy up #77

wants to merge 4 commits into from

Conversation

JOT85
Copy link
Contributor

@JOT85 JOT85 commented Jan 4, 2021

I'm about to make a couple of PRs but, before that, I've spent a bit of time tidying a few things up. These are only minor things, including:

  • use std::fs::read_to_string function,
  • use lines method on a BufReader,
  • use iterators directly rather than collecting everything in to a vec (removes a bunch of allocation),
  • add a couple of debug_asserts,
  • a little bit of general formatting (mixed tabs -> all spaces, correct indentation levels etc),
  • fixing clippy lints.

I've also added /usr/lib/os-release as a fallback to /etc/os-release as specified in the man page.

Thanks for your time :)

This includes:
- using the `std::fs::read_to_string` function,
- using the `lines` method on a `BufReader`,
- iterators directly rather than collecting everything in to a vec,
- adding a couple of `debug_assert`s,
- a little bit of general formatting (mixed tabs -> all spaces, correct
  indentation levels etc).

`man os-release` specifies that `/usr/lib/os-release` should be used if
`/etc/os-release` can't.
@JOT85
Copy link
Contributor Author

JOT85 commented Jan 8, 2021

Merge conflict from #78 resolved :)

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.

1 participant