Skip to content

Add assertion in produce method to check buffer capacity in implementations for BufWriter #316

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

Merged
merged 3 commits into from
Mar 14, 2025

Conversation

pluveto
Copy link
Contributor

@pluveto pluveto commented Nov 26, 2024

No description provided.

Copy link
Collaborator

@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

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

Thank you!

I think it makes sense to panic if implementation of underlying I/O objects is wrong.

How do you think @robjtede ?

@link2xt
Copy link
Contributor

link2xt commented Mar 14, 2025

I generally prefer debug_assert! so libraries do not panic in production. Using assert! is not much better than using .unwrap() "because this should never return an error". It is very hard to debug a mobile app and get logs from a user when the app crashes because something in compression library decided to panic.

Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
@NobodyXu
Copy link
Collaborator

NobodyXu commented Mar 14, 2025

I generally prefer debug_assert! so libraries do not panic in production. Using assert! is not much better than using .unwrap() "because this should never return an error". It is very hard to debug a mobile app and get logs from a user when the app crashes because something in compression library decided to panic.

Thanks I think that makes sense to me

Applied the suggestion

@NobodyXu NobodyXu enabled auto-merge March 14, 2025 09:35
@NobodyXu NobodyXu added this pull request to the merge queue Mar 14, 2025
Merged via the queue into Nullus157:main with commit c695fc2 Mar 14, 2025
17 checks passed
Copy link

codecov bot commented Mar 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (eb7abe2) to head (292ea4c).
Report is 25 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #316   +/-   ##
===========================
===========================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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