File tree Expand file tree Collapse file tree 1 file changed +19
-17
lines changed
src/codegen/postprocessing Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -16,24 +16,26 @@ struct Visitor;
16
16
17
17
impl Visitor {
18
18
fn add_unsafe_block ( & self , sig : & syn:: Signature , block : & mut syn:: Block ) {
19
- if sig. unsafety . is_some ( ) {
20
- let inner_block = std:: mem:: replace (
21
- block,
22
- syn:: Block {
23
- brace_token : Default :: default ( ) ,
24
- stmts : Default :: default ( ) ,
25
- } ,
26
- ) ;
27
-
28
- block. stmts . push ( Stmt :: Expr (
29
- ExprUnsafe {
30
- attrs : Default :: default ( ) ,
31
- block : inner_block,
32
- unsafe_token : Default :: default ( ) ,
33
- }
34
- . into ( ) ,
35
- ) ) ;
19
+ if sig. unsafety . is_none ( ) {
20
+ return ;
36
21
}
22
+
23
+ let inner_block = std:: mem:: replace (
24
+ block,
25
+ syn:: Block {
26
+ brace_token : Default :: default ( ) ,
27
+ stmts : Default :: default ( ) ,
28
+ } ,
29
+ ) ;
30
+
31
+ block. stmts . push ( Stmt :: Expr (
32
+ ExprUnsafe {
33
+ attrs : Default :: default ( ) ,
34
+ block : inner_block,
35
+ unsafe_token : Default :: default ( ) ,
36
+ }
37
+ . into ( ) ,
38
+ ) ) ;
37
39
}
38
40
}
39
41
You can’t perform that action at this time.
0 commit comments