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

Change validation to a debug assert #481

Merged
merged 1 commit into from
Dec 22, 2022

Conversation

andrews05
Copy link
Collaborator

@andrews05 andrews05 commented Dec 19, 2022

As discussed in #478, assuming you're happy to proceed with this :)

As far as I can tell, there's no way to control dependencies or features based on the build profile, which means we have to use debug asserts (either that or restrict it to tests only). It still keeps the release binary smaller though.

P.S. Can we remove issue-167 now? 🤣 (this is the really big one that was only failing because of a bug in the image crate)

Closes #478
Fixes #473

@andrews05 andrews05 force-pushed the validation branch 2 times, most recently from da687be to 26034d4 Compare December 19, 2022 18:45
@shssoichiro
Copy link
Owner

Oh, removing the test for issue-167 because it's slow? Yes, I'd be fine with that. 😅

@shssoichiro shssoichiro merged commit 91e2914 into shssoichiro:master Dec 22, 2022
@andrews05 andrews05 deleted the validation branch December 23, 2022 01:39
@andrews05 andrews05 mentioned this pull request Jan 5, 2023
shssoichiro pushed a commit that referenced this pull request Apr 24, 2023
* Make dependency on `image` optional

After PR #481 was merged, the
`image` dependency became unused when building with debug assertions
disabled, as it is only used to implement output sanity checks when such
assertions are enabled.

The `image` crate transitively pulls a significant amount of
dependencies, so it's useful for OxiPNG users to get rid of them when
not needed.

[Cargo does not allow specifying dependencies that are only pulled when
debug assertions are
enabled](rust-lang/cargo#7634), so the next
best way to give users some flexibility is to gate those debug
assertions behind a feature flag.

These changes add a `sanity-checks` feature flag that controls whether
the `image` crate and the related sanity checks are compiled in. This
feature is enabled by default to keep debug builds useful to catch
problems during development.

* Fix Clippy lints

* Run tests with new sanity-checks feature enabled
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.

Thinking about output validation Resulting image is corrupted with oxipng 6.0.1 and 7.0.0 but not 5.0.1
2 participants