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

Upgrade nom dependency to 7.1.3 #41

Merged
merged 5 commits into from
Nov 27, 2024

Conversation

ahartel
Copy link
Contributor

@ahartel ahartel commented Nov 4, 2024

No description provided.

@jedireza
Copy link
Owner

jedireza commented Nov 4, 2024

Thanks for creating a PR!! 🦾

Looks like a couple checks failed. Rustfmt should be easy to resolve. Overall the changes seem reasonable, but I also wasn't able to review in depth yet. I'm hoping that @jhwgh1968 might be able to take a look. I'm also hopeful our test cases cover enough to give confidence.

Copy link
Collaborator

@jhwgh1968 jhwgh1968 left a comment

Choose a reason for hiding this comment

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

Thanks indeed @ahartel!

Looking over this quickly, I appreciate a lot of the fixes and lints. In the end, I have only one key question

Why was ToString trait impl changed to Display?

I am not sure exactly why I chose ToString but I think it had to do with trait compatibility. Note also the impl of From on every "string reference" type.

There is also behavior around Debug which would be affected by Display and I am not quite sure about.

Does this change facilitate something specific besides those .to_string() removals?

@ahartel
Copy link
Contributor Author

ahartel commented Nov 7, 2024

Thanks for taking a look!

Why was ToString trait impl changed to Display?

The lint that clippy gave was this one.
It basically says that the ToString trait gets automatically implemented for any type which implements Display. From that perspective it should probably be fine?!

@ahartel
Copy link
Contributor Author

ahartel commented Nov 7, 2024

I fixed the formatting and one more clippy lint which I had missed.
But it seems that the failing test is the test record::raw_tests::verify_display which is testing the stringification of the type RawRecordHeader. But I didn't change the Display impl of that type at all.
The test is failing both on the beta 1.83 and on the stable 1.82 toolchain. And it is also only failing sometimes. Which seems to imply that this has something to do with non-guaranteed order of the formatter?!

My proposal would be to change the assert to a "contains" assert. Any thoughts?

@jhwgh1968
Copy link
Collaborator

jhwgh1968 commented Nov 12, 2024

The lint that clippy gave was this one.

Ah, I did not know about this lint when I wrote the code! I guess that makes sense to change to a Display attribute then. If they want the output I originally had, it can be Debug.

Based on this, please do a "major bump" of the crate version -- so in this case, a second digit. Changing this trait behavior can indeed have consequences.

My proposal would be to change the assert to a "contains" assert. Any thoughts?

That test was written to ensure that the format would be exactly correct for what was input, because this would be used for outputting it to data streams. So I am worried about contains.

I suspect this test has always been 50-50 due to a coin flip on the HashMap which contains a random factor. I would actually rather have then be collected into a list and sorted for consistent output -- both for the test and for the end user.

Hopefully that would not be too much trouble?

Thanks for your work on this!

@jedireza
Copy link
Owner

But it seems that the failing test is the test record::raw_tests::verify_display which is testing the stringification of the type RawRecordHeader.

Funny I never noticed or don't remember this was flaky. There's a proposed fix for that over here: #42 (review)

@ahartel
Copy link
Contributor Author

ahartel commented Nov 12, 2024

Based on this, please do a "major bump" of the crate version -- so in this case, a second digit. Changing this trait behavior can indeed have consequences.

Done

@ahartel
Copy link
Contributor Author

ahartel commented Nov 12, 2024

Funny I never noticed or don't remember this was flaky. There's a proposed fix for that over here: #42 (review)

Thanks for pointing that out. Didn't change the test in this case.

@ahartel ahartel force-pushed the upgrade-nom-dependency branch from 6d8a25f to e508f96 Compare November 12, 2024 20:49
@jhwgh1968
Copy link
Collaborator

Hmm, I see.

While I'd like to see a complete output test, I will accept that other fix for now. Hopefully once that merges this can too.

@ahartel ahartel force-pushed the upgrade-nom-dependency branch from e508f96 to 52dc64c Compare November 26, 2024 08:03
src/parser.rs Show resolved Hide resolved
src/warc_reader.rs Show resolved Hide resolved
@jedireza jedireza merged commit 31235a2 into jedireza:master Nov 27, 2024
8 checks passed
@jedireza
Copy link
Owner

Published as v0.4.0

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