coro_kind -> coroutine_kind

This commit is contained in:
Michael Goulet 2023-12-05 21:39:36 +00:00
parent f114bb42ec
commit 6ebb66cea9
4 changed files with 23 additions and 14 deletions

View File

@ -29,7 +29,7 @@ pub(crate) fn rewrite_closure(
binder: &ast::ClosureBinder,
constness: ast::Const,
capture: ast::CaptureBy,
coro_kind: &Option<ast::CoroutineKind>,
coroutine_kind: &Option<ast::CoroutineKind>,
movability: ast::Movability,
fn_decl: &ast::FnDecl,
body: &ast::Expr,
@ -40,7 +40,16 @@ pub(crate) fn rewrite_closure(
debug!("rewrite_closure {:?}", body);
let (prefix, extra_offset) = rewrite_closure_fn_decl(
binder, constness, capture, coro_kind, movability, fn_decl, body, span, context, shape,
binder,
constness,
capture,
coroutine_kind,
movability,
fn_decl,
body,
span,
context,
shape,
)?;
// 1 = space between `|...|` and body.
let body_shape = shape.offset_left(extra_offset)?;
@ -233,7 +242,7 @@ fn rewrite_closure_fn_decl(
binder: &ast::ClosureBinder,
constness: ast::Const,
capture: ast::CaptureBy,
coro_kind: &Option<ast::CoroutineKind>,
coroutine_kind: &Option<ast::CoroutineKind>,
movability: ast::Movability,
fn_decl: &ast::FnDecl,
body: &ast::Expr,
@ -263,7 +272,7 @@ fn rewrite_closure_fn_decl(
} else {
""
};
let coro = match coro_kind {
let coro = match coroutine_kind {
Some(ast::CoroutineKind::Async { .. }) => "async ",
Some(ast::CoroutineKind::Gen { .. }) => "gen ",
None => "",
@ -343,7 +352,7 @@ pub(crate) fn rewrite_last_closure(
ref binder,
constness,
capture_clause,
ref coro_kind,
ref coroutine_kind,
movability,
ref fn_decl,
ref body,
@ -364,7 +373,7 @@ pub(crate) fn rewrite_last_closure(
binder,
constness,
capture_clause,
coro_kind,
coroutine_kind,
movability,
fn_decl,
body,

View File

@ -212,7 +212,7 @@ pub(crate) fn format_expr(
&cl.binder,
cl.constness,
cl.capture_clause,
&cl.coro_kind,
&cl.coroutine_kind,
cl.movability,
&cl.fn_decl,
&cl.body,

View File

@ -287,7 +287,7 @@ pub(crate) struct FnSig<'a> {
decl: &'a ast::FnDecl,
generics: &'a ast::Generics,
ext: ast::Extern,
coro_kind: Cow<'a, Option<ast::CoroutineKind>>,
coroutine_kind: Cow<'a, Option<ast::CoroutineKind>>,
constness: ast::Const,
defaultness: ast::Defaultness,
unsafety: ast::Unsafe,
@ -302,7 +302,7 @@ pub(crate) fn from_method_sig(
) -> FnSig<'a> {
FnSig {
unsafety: method_sig.header.unsafety,
coro_kind: Cow::Borrowed(&method_sig.header.coro_kind),
coroutine_kind: Cow::Borrowed(&method_sig.header.coroutine_kind),
constness: method_sig.header.constness,
defaultness: ast::Defaultness::Final,
ext: method_sig.header.ext,
@ -328,7 +328,7 @@ pub(crate) fn from_fn_kind(
generics,
ext: fn_sig.header.ext,
constness: fn_sig.header.constness,
coro_kind: Cow::Borrowed(&fn_sig.header.coro_kind),
coroutine_kind: Cow::Borrowed(&fn_sig.header.coroutine_kind),
defaultness,
unsafety: fn_sig.header.unsafety,
visibility: vis,
@ -343,8 +343,8 @@ fn to_str(&self, context: &RewriteContext<'_>) -> String {
result.push_str(&*format_visibility(context, self.visibility));
result.push_str(format_defaultness(self.defaultness));
result.push_str(format_constness(self.constness));
self.coro_kind
.map(|coro_kind| result.push_str(format_coro(&coro_kind)));
self.coroutine_kind
.map(|coroutine_kind| result.push_str(format_coro(&coroutine_kind)));
result.push_str(format_unsafety(self.unsafety));
result.push_str(&format_extern(
self.ext,

View File

@ -75,8 +75,8 @@ pub(crate) fn format_visibility(
}
#[inline]
pub(crate) fn format_coro(coro_kind: &ast::CoroutineKind) -> &'static str {
match coro_kind {
pub(crate) fn format_coro(coroutine_kind: &ast::CoroutineKind) -> &'static str {
match coroutine_kind {
ast::CoroutineKind::Async { .. } => "async ",
ast::CoroutineKind::Gen { .. } => "gen ",
}