This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,8 @@ where
298
298
<I as Iterator >:: Item : Deref ,
299
299
<I :: Item as Deref >:: Target : Rewrite + Spanned + ' a ,
300
300
{
301
+ debug ! ( "format_function_type {:#?}" , shape) ;
302
+
301
303
// Code for handling variadics is somewhat duplicated for items, but they
302
304
// are different enough to need some serious refactoring to share code.
303
305
enum ArgumentKind < T >
@@ -706,6 +708,8 @@ fn rewrite_bare_fn(
706
708
context : & RewriteContext ,
707
709
shape : Shape ,
708
710
) -> Option < String > {
711
+ debug ! ( "rewrite_bare_fn {:#?}" , shape) ;
712
+
709
713
let mut result = String :: with_capacity ( 128 ) ;
710
714
711
715
if let Some ( ref lifetime_str) = rewrite_lifetime_param ( context, shape, & bare_fn. generic_params )
@@ -728,7 +732,11 @@ fn rewrite_bare_fn(
728
732
729
733
result. push_str ( "fn" ) ;
730
734
731
- let func_ty_shape = shape. offset_left ( result. len ( ) ) ?;
735
+ let func_ty_shape = if context. use_block_indent ( ) {
736
+ shape. offset_left ( result. len ( ) ) ?
737
+ } else {
738
+ shape. visual_indent ( result. len ( ) ) . sub_width ( result. len ( ) ) ?
739
+ } ;
732
740
733
741
let rewrite = format_function_type (
734
742
bare_fn. decl . inputs . iter ( ) ,
Original file line number Diff line number Diff line change
1
+ // rustfmt-indent_style: Visual
2
+ struct Functions {
3
+ RunListenServer : unsafe extern "C" fn ( * mut c_void ,
4
+ * mut c_char ,
5
+ * mut c_char ,
6
+ * mut c_char ,
7
+ * mut c_void ,
8
+ * mut c_void ) -> c_int ,
9
+ }
Original file line number Diff line number Diff line change
1
+ // rustfmt-indent_style: Visual
2
+ struct Functions {
3
+ RunListenServer : unsafe extern "C" fn ( * mut c_void ,
4
+ * mut c_char ,
5
+ * mut c_char ,
6
+ * mut c_char ,
7
+ * mut c_void ,
8
+ * mut c_void )
9
+ -> c_int ,
10
+ }
You can’t perform that action at this time.
0 commit comments