Fix warnings in rustc 1.46.0
Functions that can return errors must be handled. Using the ?
operator will bubble up those errors.
The case of making a closure to pass to onload could not use
the ? in its body, so this uses expect() instead.
Also makes constant GENERIC_BOX_STYLES all caps, as the compiler warned about this as well. While doing so, made the string multi-line for legibility.
I don't know any Rust, so I was trying to build this example. I got some warnings and thought I'd look into what those were about. This made them go away... but...
...I can't actually test these changes... because the Make process gives me:
Compiling (...)
Compiling d0 v0.1.0 (/home/ae1020/Projects/draw-app)
Finished release [optimized] target(s) in 2m 49s
[INFO]: License key is set in Cargo.toml but no LICENSE file(s) were found; Please add the LICENSE file(s) to your project directory
error: failed to validate `/home/ae1020/Projects/draw-app/target/wasm32-unknown-unknown/release/d0.wasm`
Caused by:
Unexpected EOF (at offset 2076395)
Error: Running the wasm-bindgen CLI
Caused by: failed to execute `wasm-bindgen`: exited with exit code: 1
I get this with wasm-pack build --dev as well, so it's not an optimization issue.
Can you still build this project with a recent Rust?