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

Forbid missing Debug implementations #673

Merged
merged 4 commits into from
Oct 13, 2019

Conversation

hgzimmerman
Copy link
Member

Denies any public type from missing a debug implementation.

Some exceptions are made for rarely used types, and types that are only used as reach associated type parameters to agents.

This offers the peace of mind that any end-user can just slap a #[derive(Debug)] on their component, and it will compile without them having to do a custom debug impl.

The trade off is slightly longer compile times, and likely a more bloated WASM binary.


There was a recent addition in rust 1.38.0 of std::any::type_name.

This would allow yew to offer better information about what inner types our opaque and generic types correspond to instead of just punting and saying "Opaque<_>" for our debug strings.
Since this would require a bump to a higher version of rustc to support this, I didn't include it, because it isn't worth that for marginally better debug diagnostics.

Its just another thing to keep in the back of your mind if the minimum supported version is ever raised.

src/agent.rs Outdated Show resolved Hide resolved
src/html/listener.rs Show resolved Hide resolved
@jstarry jstarry merged commit 0b59933 into yewstack:master Oct 13, 2019
hgzimmerman added a commit to hgzimmerman/yew that referenced this pull request Oct 14, 2019
* Forbid missing debug implementations

* someday I'll remember to run cargo fmt before pushing the first time

* add debug for other format types

* derive debug for HandlerId
llebout pushed a commit to llebout/yew that referenced this pull request Jan 20, 2020
* Forbid missing debug implementations

* someday I'll remember to run cargo fmt before pushing the first time

* add debug for other format types

* derive debug for HandlerId
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.

2 participants