File tree 1 file changed +7
-10
lines changed 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -363,7 +363,7 @@ fn initialize_adapter() -> Adapter {
363
363
364
364
#[ cfg( all( target_arch = "wasm32" , feature = "webgl" ) ) ]
365
365
fn create_html_canvas ( ) -> HtmlCanvasElement {
366
- return web_sys:: window ( )
366
+ web_sys:: window ( )
367
367
. and_then ( |win| win. document ( ) )
368
368
. and_then ( |doc| {
369
369
let body = doc. body ( ) . unwrap ( ) ;
@@ -372,19 +372,16 @@ fn create_html_canvas() -> HtmlCanvasElement {
372
372
body. append_child ( & canvas) . unwrap ( ) ;
373
373
canvas. dyn_into :: < web_sys:: HtmlCanvasElement > ( ) . ok ( )
374
374
} )
375
- . expect ( "couldn't append canvas to document body" ) ;
375
+ . expect ( "couldn't append canvas to document body" )
376
376
}
377
377
378
378
#[ cfg( all( target_arch = "wasm32" , feature = "webgl" ) ) ]
379
379
fn delete_html_canvas ( ) {
380
- web_sys:: window ( )
381
- . and_then ( |win| win. document ( ) )
382
- . and_then ( |document| {
383
- if let Some ( element) = document. get_element_by_id ( CANVAS_ID ) {
384
- element. remove ( ) ;
385
- }
386
- Some ( ( ) )
387
- } ) ;
380
+ if let Some ( document) = web_sys:: window ( ) . and_then ( |win| win. document ( ) ) {
381
+ if let Some ( element) = document. get_element_by_id ( CANVAS_ID ) {
382
+ element. remove ( ) ;
383
+ }
384
+ } ;
388
385
}
389
386
390
387
// Run some code in an error scope and assert that validation fails.
You can’t perform that action at this time.
0 commit comments