File tree 5 files changed +12
-23
lines changed
5 files changed +12
-23
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,6 @@ impl<'a> Item<'a> {
248
248
abi : format_extern (
249
249
ast:: Extern :: from_abi ( fm. abi , DUMMY_SP ) ,
250
250
config. force_explicit_abi ( ) ,
251
- true ,
252
251
) ,
253
252
vis : None ,
254
253
body : fm
@@ -336,7 +335,6 @@ impl<'a> FnSig<'a> {
336
335
result. push_str ( & format_extern (
337
336
self . ext ,
338
337
context. config . force_explicit_abi ( ) ,
339
- false ,
340
338
) ) ;
341
339
result
342
340
}
Original file line number Diff line number Diff line change @@ -892,7 +892,6 @@ fn rewrite_bare_fn(
892
892
result. push_str ( & format_extern (
893
893
bare_fn. ext ,
894
894
context. config . force_explicit_abi ( ) ,
895
- false ,
896
895
) ) ;
897
896
898
897
result. push_str ( "fn" ) ;
Original file line number Diff line number Diff line change @@ -131,23 +131,14 @@ pub(crate) fn format_mutability(mutability: ast::Mutability) -> &'static str {
131
131
}
132
132
133
133
#[ inline]
134
- pub ( crate ) fn format_extern (
135
- ext : ast:: Extern ,
136
- explicit_abi : bool ,
137
- is_mod : bool ,
138
- ) -> Cow < ' static , str > {
139
- let abi = match ext {
140
- ast:: Extern :: None => "Rust" . to_owned ( ) ,
141
- ast:: Extern :: Implicit ( _) => "C" . to_owned ( ) ,
142
- ast:: Extern :: Explicit ( abi, _) => abi. symbol_unescaped . to_string ( ) ,
143
- } ;
144
-
145
- if abi == "Rust" && !is_mod {
146
- Cow :: from ( "" )
147
- } else if abi == "C" && !explicit_abi {
148
- Cow :: from ( "extern " )
149
- } else {
150
- Cow :: from ( format ! ( r#"extern "{}" "# , abi) )
134
+ pub ( crate ) fn format_extern ( ext : ast:: Extern , force_explicit_abi : bool ) -> Cow < ' static , str > {
135
+ match ext {
136
+ ast:: Extern :: None => Cow :: from ( "" ) ,
137
+ ast:: Extern :: Implicit ( _) if force_explicit_abi => Cow :: from ( "extern \" C\" " ) ,
138
+ ast:: Extern :: Implicit ( _) => Cow :: from ( "extern " ) ,
139
+ ast:: Extern :: Explicit ( abi, _) => {
140
+ Cow :: from ( format ! ( r#"extern "{}" "# , abi. symbol_unescaped) )
141
+ }
151
142
}
152
143
}
153
144
Original file line number Diff line number Diff line change
1
+ extern "Rust" fn uwu ( ) { }
Original file line number Diff line number Diff line change 1
1
// rustfmt-force_explicit_abi: false
2
2
3
- extern {
3
+ extern "C" {
4
4
fn some_fn ( ) -> ( ) ;
5
5
}
6
6
7
- extern fn sup ( ) { }
7
+ extern "C" fn sup ( ) { }
8
8
9
- type funky_func = extern fn (
9
+ type funky_func = extern "C" fn (
10
10
unsafe extern "rust-call" fn (
11
11
* const JSJitInfo ,
12
12
* mut JSContext ,
You can’t perform that action at this time.
0 commit comments