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

Extract uucore::line_ending::LineEnding #5120

Merged
merged 12 commits into from
Aug 20, 2023
Merged

Conversation

simon04
Copy link
Contributor

@simon04 simon04 commented Jul 29, 2023

Aims to provide consistent newline/zero terminator handling.

Aims to provide consistent newline/zero terminator handling.
Copy link
Member

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

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

Nice idea! I just have some small suggestions.

Just so that the idea is out here (but not necessarily better), we could also make this a newtype around u8:

struct LineEnding(u8);

const NEWLINE = ...;
const ZERO = ...;

I like the enum approach too though. Could you also run cargo fmt?

src/uucore/src/lib/mods/line_ending.rs Outdated Show resolved Hide resolved
src/uu/head/src/head.rs Outdated Show resolved Hide resolved
src/uu/head/src/head.rs Outdated Show resolved Hide resolved
src/uucore/src/lib/mods/line_ending.rs Outdated Show resolved Hide resolved
src/uucore/src/lib/mods/line_ending.rs Outdated Show resolved Hide resolved
src/uucore/src/lib/mods/line_ending.rs Outdated Show resolved Hide resolved
@simon04
Copy link
Contributor Author

simon04 commented Jul 30, 2023

@tertsdiepraam, thank you for taking your time and reviewing my PR. Anything left to be done?

Copy link
Member

@tertsdiepraam tertsdiepraam left a comment

Choose a reason for hiding this comment

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

I like it! Just one last thing as far as I can see (and the CI might complain but we'll see how that goes).

src/uu/head/src/head.rs Outdated Show resolved Hide resolved
@tertsdiepraam
Copy link
Member

Some small style warnings left, but otherwise ready to be merged!

@simon04
Copy link
Contributor Author

simon04 commented Aug 18, 2023

Hi, I'm back from vacation. Thanks for the pointer. I've fixed the remaining clippy warning. Hopefully everything is fine now.

@tertsdiepraam
Copy link
Member

Nice! Now it's my turn to ask for your feedback. I've pushed a commit with a bit more documentation. Let me know if you agree with what I wrote!

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail-2/inotify-dir-recreate

@simon04
Copy link
Contributor Author

simon04 commented Aug 20, 2023

Great, thanks for taking care of the documentation. :-)

@tertsdiepraam tertsdiepraam merged commit 8728186 into uutils:main Aug 20, 2023
43 of 45 checks passed
@sylvestre
Copy link
Sponsor Contributor

bravo for this work :)

zhitkoff pushed a commit to zhitkoff/coreutils that referenced this pull request Aug 22, 2023
* Extract uucore::line_ending::LineEnding

Aims to provide consistent newline/zero terminator handling.

* Apply suggestions from code review

Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>

* cargo fmt

* Use uucore::line_ending::LineEnding

* Remove uucore::line_ending::LineEnding::Space

* Rename LineEnding::from_zero_flag

* Replace LineEnding::None with Option<LineEnding>

* cargo clippy

* assert_eq

* cargo clippy

* cargo clippy

* uucore/line_ending: add more documentation

---------

Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
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.

3 participants