@@ -382,29 +382,27 @@ impl<'a> Linker for GccLinker<'a> {
382
382
383
383
if self . sess . target . target . options . is_like_osx {
384
384
// Write a plain, newline-separated list of symbols
385
- let res = ( || -> io:: Result < ( ) > {
385
+ let res: io:: Result < ( ) > = try {
386
386
let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
387
387
for sym in self . info . exports [ & crate_type] . iter ( ) {
388
388
debug ! ( " _{}" , sym) ;
389
389
writeln ! ( f, "_{}" , sym) ?;
390
390
}
391
- Ok ( ( ) )
392
- } ) ( ) ;
391
+ } ;
393
392
if let Err ( e) = res {
394
393
self . sess . fatal ( & format ! ( "failed to write lib.def file: {}" , e) ) ;
395
394
}
396
395
} else {
397
396
// Write an LD version script
398
- let res = ( || -> io:: Result < ( ) > {
397
+ let res: io:: Result < ( ) > = try {
399
398
let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
400
399
writeln ! ( f, "{{\n global:" ) ?;
401
400
for sym in self . info . exports [ & crate_type] . iter ( ) {
402
401
debug ! ( " {};" , sym) ;
403
402
writeln ! ( f, " {};" , sym) ?;
404
403
}
405
404
writeln ! ( f, "\n local:\n *;\n }};" ) ?;
406
- Ok ( ( ) )
407
- } ) ( ) ;
405
+ } ;
408
406
if let Err ( e) = res {
409
407
self . sess . fatal ( & format ! ( "failed to write version script: {}" , e) ) ;
410
408
}
@@ -644,7 +642,7 @@ impl<'a> Linker for MsvcLinker<'a> {
644
642
tmpdir : & Path ,
645
643
crate_type : CrateType ) {
646
644
let path = tmpdir. join ( "lib.def" ) ;
647
- let res = ( || -> io:: Result < ( ) > {
645
+ let res: io:: Result < ( ) > = try {
648
646
let mut f = BufWriter :: new ( File :: create ( & path) ?) ;
649
647
650
648
// Start off with the standard module name header and then go
@@ -655,8 +653,7 @@ impl<'a> Linker for MsvcLinker<'a> {
655
653
debug ! ( " _{}" , symbol) ;
656
654
writeln ! ( f, " {}" , symbol) ?;
657
655
}
658
- Ok ( ( ) )
659
- } ) ( ) ;
656
+ } ;
660
657
if let Err ( e) = res {
661
658
self . sess . fatal ( & format ! ( "failed to write lib.def file: {}" , e) ) ;
662
659
}
0 commit comments