Skip to content

refactor: use expect instead of map_or where it convolutes the code #4

@Limegrass

Description

@Limegrass

There are probably a lot of locations in code where I used map_or (eg. for web_sys::window()) instead of just calling expect on it, since they should probably always be available in any browser environment. Further research to confirm this would be nice.

This convolutes the code and makes it harder to read, and I've made it reach fairly deep in this manner.
This was originally an intention to avoid panics, as suggested in the rust wasm guide as one possible approach by removing all panics. I likely did not get rid of all panics, and it seems as if the error strings included would also contribute to the wasm size, so it seems like a vain effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorChanges that do not affect functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions