File tree 3 files changed +34
-20
lines changed
3 files changed +34
-20
lines changed Original file line number Diff line number Diff line change @@ -465,12 +465,10 @@ impl<'a> Context<'a> {
465
465
} ;
466
466
467
467
let default_module_path = match self . config . mode {
468
- OutputMode :: Web => {
469
- "\
468
+ OutputMode :: Web => "\
470
469
if (typeof module === 'undefined') {
471
470
module = import.meta.url.replace(/\\ .js$/, '_bg.wasm');
472
- }"
473
- }
471
+ }" ,
474
472
_ => "" ,
475
473
} ;
476
474
@@ -872,21 +870,30 @@ impl<'a> Context<'a> {
872
870
873
871
match self . config . encode_into {
874
872
EncodeInto :: Always if !shared => {
875
- self . global ( & format ! ( "
873
+ self . global ( & format ! (
874
+ "
876
875
const encodeString = {};
877
- " , encode_into) ) ;
876
+ " ,
877
+ encode_into
878
+ ) ) ;
878
879
}
879
880
EncodeInto :: Test if !shared => {
880
- self . global ( & format ! ( "
881
+ self . global ( & format ! (
882
+ "
881
883
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
882
884
? {}
883
885
: {});
884
- " , encode_into, encode) ) ;
886
+ " ,
887
+ encode_into, encode
888
+ ) ) ;
885
889
}
886
890
_ => {
887
- self . global ( & format ! ( "
891
+ self . global ( & format ! (
892
+ "
888
893
const encodeString = {};
889
- " , encode) ) ;
894
+ " ,
895
+ encode
896
+ ) ) ;
890
897
}
891
898
}
892
899
@@ -1080,7 +1087,6 @@ impl<'a> Context<'a> {
1080
1087
fields : Vec :: new ( ) ,
1081
1088
} ) ?;
1082
1089
self . global ( & format ! ( "let cached{} = new {}{};" , s, name, args) ) ;
1083
-
1084
1090
} else if !self . config . mode . always_run_in_browser ( ) {
1085
1091
self . global ( & format ! (
1086
1092
"
@@ -1090,7 +1096,6 @@ impl<'a> Context<'a> {
1090
1096
s
1091
1097
) ) ;
1092
1098
self . global ( & format ! ( "let cached{0} = new l{0}{1};" , s, args) ) ;
1093
-
1094
1099
} else {
1095
1100
self . global ( & format ! ( "let cached{0} = new {0}{1};" , s, args) ) ;
1096
1101
}
Original file line number Diff line number Diff line change @@ -337,7 +337,12 @@ impl Bindgen {
337
337
// the webidl bindings proposal) as well as an auxiliary section for all
338
338
// sorts of miscellaneous information and features #[wasm_bindgen]
339
339
// supports that aren't covered by WebIDL bindings.
340
- webidl:: process ( & mut module, self . anyref , self . wasm_interface_types , self . emit_start ) ?;
340
+ webidl:: process (
341
+ & mut module,
342
+ self . anyref ,
343
+ self . wasm_interface_types ,
344
+ self . emit_start ,
345
+ ) ?;
341
346
342
347
// Now that we've got type information from the webidl processing pass,
343
348
// touch up the output of rustc to insert anyref shims where necessary.
@@ -563,16 +568,14 @@ impl Output {
563
568
} else {
564
569
format ! ( "{}_bg" , self . stem)
565
570
} ;
566
- let wasm_path = out_dir
567
- . join ( wasm_name)
568
- . with_extension ( "wasm" ) ;
571
+ let wasm_path = out_dir. join ( wasm_name) . with_extension ( "wasm" ) ;
569
572
fs:: create_dir_all ( out_dir) ?;
570
573
let wasm_bytes = self . module . emit_wasm ( ) ;
571
574
fs:: write ( & wasm_path, wasm_bytes)
572
575
. with_context ( |_| format ! ( "failed to write `{}`" , wasm_path. display( ) ) ) ?;
573
576
574
577
if self . wasm_interface_types {
575
- return Ok ( ( ) )
578
+ return Ok ( ( ) ) ;
576
579
}
577
580
578
581
// Write out all local JS snippets to the final destination now that
Original file line number Diff line number Diff line change @@ -453,7 +453,7 @@ fn extract_incoming(
453
453
exprs. push ( e. clone ( ) ) ;
454
454
continue ;
455
455
}
456
- NonstandardIncoming :: Int64 { .. } => "64-bit integer" ,
456
+ NonstandardIncoming :: Int64 { .. } => "64-bit integer" ,
457
457
NonstandardIncoming :: AllocCopyInt64 { .. } => "64-bit integer array" ,
458
458
NonstandardIncoming :: AllocCopyAnyrefArray { .. } => "array of JsValue" ,
459
459
NonstandardIncoming :: MutableSlice { .. } => "mutable slice" ,
@@ -472,7 +472,10 @@ fn extract_incoming(
472
472
NonstandardIncoming :: Char { .. } => "character" ,
473
473
NonstandardIncoming :: BorrowedAnyref { .. } => "borrowed anyref" ,
474
474
} ;
475
- bail ! ( "cannot represent {} with a standard bindings expression" , desc) ;
475
+ bail ! (
476
+ "cannot represent {} with a standard bindings expression" ,
477
+ desc
478
+ ) ;
476
479
}
477
480
Ok ( exprs)
478
481
}
@@ -525,7 +528,10 @@ fn extract_outgoing(
525
528
NonstandardOutgoing :: OptionRustType { .. } => "optional rust type" ,
526
529
NonstandardOutgoing :: StackClosure { .. } => "closures" ,
527
530
} ;
528
- bail ! ( "cannot represent {} with a standard bindings expression" , desc) ;
531
+ bail ! (
532
+ "cannot represent {} with a standard bindings expression" ,
533
+ desc
534
+ ) ;
529
535
}
530
536
Ok ( exprs)
531
537
}
You can’t perform that action at this time.
0 commit comments