Address code review feedback
This commit is contained in:
parent
13d284d177
commit
f114bb42ec
@ -263,12 +263,10 @@ fn rewrite_closure_fn_decl(
|
|||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
let (is_async, is_gen) = if let Some(coro_kind) = coro_kind {
|
let coro = match coro_kind {
|
||||||
let is_async = if coro_kind.is_async() { "async " } else { "" };
|
Some(ast::CoroutineKind::Async { .. }) => "async ",
|
||||||
let is_gen = if coro_kind.is_gen() { "gen " } else { "" };
|
Some(ast::CoroutineKind::Gen { .. }) => "gen ",
|
||||||
(is_async, is_gen)
|
None => "",
|
||||||
} else {
|
|
||||||
("", "")
|
|
||||||
};
|
};
|
||||||
let mover = if matches!(capture, ast::CaptureBy::Value { .. }) {
|
let mover = if matches!(capture, ast::CaptureBy::Value { .. }) {
|
||||||
"move "
|
"move "
|
||||||
@ -278,14 +276,7 @@ fn rewrite_closure_fn_decl(
|
|||||||
// 4 = "|| {".len(), which is overconservative when the closure consists of
|
// 4 = "|| {".len(), which is overconservative when the closure consists of
|
||||||
// a single expression.
|
// a single expression.
|
||||||
let nested_shape = shape
|
let nested_shape = shape
|
||||||
.shrink_left(
|
.shrink_left(binder.len() + const_.len() + immovable.len() + coro.len() + mover.len())?
|
||||||
binder.len()
|
|
||||||
+ const_.len()
|
|
||||||
+ immovable.len()
|
|
||||||
+ is_async.len()
|
|
||||||
+ is_gen.len()
|
|
||||||
+ mover.len(),
|
|
||||||
)?
|
|
||||||
.sub_width(4)?;
|
.sub_width(4)?;
|
||||||
|
|
||||||
// 1 = |
|
// 1 = |
|
||||||
@ -323,7 +314,7 @@ fn rewrite_closure_fn_decl(
|
|||||||
.tactic(tactic)
|
.tactic(tactic)
|
||||||
.preserve_newline(true);
|
.preserve_newline(true);
|
||||||
let list_str = write_list(&item_vec, &fmt)?;
|
let list_str = write_list(&item_vec, &fmt)?;
|
||||||
let mut prefix = format!("{binder}{const_}{immovable}{is_async}{is_gen}{mover}|{list_str}|");
|
let mut prefix = format!("{binder}{const_}{immovable}{coro}{mover}|{list_str}|");
|
||||||
|
|
||||||
if !ret_str.is_empty() {
|
if !ret_str.is_empty() {
|
||||||
if prefix.contains('\n') {
|
if prefix.contains('\n') {
|
||||||
|
Loading…
Reference in New Issue
Block a user