Skip to content

Commit 3c9b986

Browse files
rustfmt: migrate BareFn -> FnPtr
1 parent e47f565 commit 3c9b986

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/tools/rustfmt/src/types.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ impl Rewrite for ast::Ty {
10091009
})
10101010
}
10111011
}
1012-
ast::TyKind::BareFn(ref bare_fn) => rewrite_bare_fn(bare_fn, self.span, context, shape),
1012+
ast::TyKind::FnPtr(ref fn_ptr) => rewrite_fn_ptr(fn_ptr, self.span, context, shape),
10131013
ast::TyKind::Never => Ok(String::from("!")),
10141014
ast::TyKind::MacCall(ref mac) => {
10151015
rewrite_macro(mac, context, shape, MacroPosition::Expression)
@@ -1105,8 +1105,8 @@ impl Rewrite for ast::TyPat {
11051105
}
11061106
}
11071107

1108-
fn rewrite_bare_fn(
1109-
bare_fn: &ast::BareFnTy,
1108+
fn rewrite_fn_ptr(
1109+
fn_ptr: &ast::FnPtrTy,
11101110
span: Span,
11111111
context: &RewriteContext<'_>,
11121112
shape: Shape,
@@ -1115,7 +1115,7 @@ fn rewrite_bare_fn(
11151115

11161116
let mut result = String::with_capacity(128);
11171117

1118-
if let Some(ref lifetime_str) = rewrite_bound_params(context, shape, &bare_fn.generic_params) {
1118+
if let Some(ref lifetime_str) = rewrite_bound_params(context, shape, &fn_ptr.generic_params) {
11191119
result.push_str("for<");
11201120
// 6 = "for<> ".len(), 4 = "for<".
11211121
// This doesn't work out so nicely for multiline situation with lots of
@@ -1124,10 +1124,10 @@ fn rewrite_bare_fn(
11241124
result.push_str("> ");
11251125
}
11261126

1127-
result.push_str(crate::utils::format_safety(bare_fn.safety));
1127+
result.push_str(crate::utils::format_safety(fn_ptr.safety));
11281128

11291129
result.push_str(&format_extern(
1130-
bare_fn.ext,
1130+
fn_ptr.ext,
11311131
context.config.force_explicit_abi(),
11321132
));
11331133

@@ -1145,9 +1145,9 @@ fn rewrite_bare_fn(
11451145
};
11461146

11471147
let rewrite = format_function_type(
1148-
bare_fn.decl.inputs.iter(),
1149-
&bare_fn.decl.output,
1150-
bare_fn.decl.c_variadic(),
1148+
fn_ptr.decl.inputs.iter(),
1149+
&fn_ptr.decl.output,
1150+
fn_ptr.decl.c_variadic(),
11511151
span,
11521152
context,
11531153
func_ty_shape,

0 commit comments

Comments
 (0)