internal: move make::expr_unit to make::ext::expr_unit

`expr_unit` is just a shortcut for a common expression, so it belongs in `make::ext`
This commit is contained in:
Giga Bowser 2024-12-16 14:38:53 -05:00
parent f388482119
commit 905e1e1fc0
8 changed files with 18 additions and 18 deletions

View file

@ -153,8 +153,9 @@ impl<N: AstNode + Clone> AstNodeEdit for N {}
#[test]
fn test_increase_indent() {
let arm_list = {
let arm = make::match_arm(iter::once(make::wildcard_pat().into()), None, make::expr_unit());
make::match_arm_list(vec![arm.clone(), arm])
let arm =
make::match_arm(iter::once(make::wildcard_pat().into()), None, make::ext::expr_unit());
make::match_arm_list([arm.clone(), arm])
};
assert_eq!(
arm_list.syntax().to_string(),

View file

@ -63,6 +63,9 @@ pub mod ext {
Some(expr)
}
pub fn expr_unit() -> ast::Expr {
expr_tuple([]).into()
}
pub fn expr_unreachable() -> ast::Expr {
expr_from_text("unreachable!()")
}
@ -546,10 +549,6 @@ pub fn hacky_block_expr(
ast_from_text(&format!("fn f() {buf}"))
}
pub fn expr_unit() -> ast::Expr {
expr_from_text("()")
}
pub fn expr_literal(text: &str) -> ast::Literal {
assert_eq!(text.trim(), text);
ast_from_text(&format!("fn f() {{ let _ = {text}; }}"))

View file

@ -550,7 +550,7 @@ mod tests {
None,
None,
make::param_list(None, []),
make::block_expr([], Some(make::expr_unit())),
make::block_expr([], Some(make::ext::expr_unit())),
Some(make::ret_type(make::ty_unit())),
false,
false,