mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
align names in make
This commit is contained in:
parent
5ebf92cd0e
commit
09d3b7d7a2
12 changed files with 29 additions and 28 deletions
|
@ -621,7 +621,7 @@ fn single_node(element: impl Into<SyntaxElement>) -> RangeInclusive<SyntaxElemen
|
|||
#[test]
|
||||
fn test_increase_indent() {
|
||||
let arm_list = {
|
||||
let arm = make::match_arm(iter::once(make::placeholder_pat().into()), make::expr_unit());
|
||||
let arm = make::match_arm(iter::once(make::wildcard_pat().into()), make::expr_unit());
|
||||
make::match_arm_list(vec![arm.clone(), arm])
|
||||
};
|
||||
assert_eq!(
|
||||
|
|
|
@ -17,7 +17,7 @@ pub fn name_ref(text: &str) -> ast::NameRef {
|
|||
ast_from_text(&format!("fn f() {{ {}; }}", text))
|
||||
}
|
||||
|
||||
pub fn type_ref(text: &str) -> ast::Type {
|
||||
pub fn ty(text: &str) -> ast::Type {
|
||||
ast_from_text(&format!("impl {} for D {{}};", text))
|
||||
}
|
||||
|
||||
|
@ -60,11 +60,11 @@ pub fn use_tree_list(use_trees: impl IntoIterator<Item = ast::UseTree>) -> ast::
|
|||
ast_from_text(&format!("use {{{}}};", use_trees))
|
||||
}
|
||||
|
||||
pub fn use_item(use_tree: ast::UseTree) -> ast::Use {
|
||||
pub fn use_(use_tree: ast::UseTree) -> ast::Use {
|
||||
ast_from_text(&format!("use {};", use_tree))
|
||||
}
|
||||
|
||||
pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordExprField {
|
||||
pub fn record_expr_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordExprField {
|
||||
return match expr {
|
||||
Some(expr) => from_text(&format!("{}: {}", name, expr)),
|
||||
None => from_text(&name.to_string()),
|
||||
|
@ -75,7 +75,7 @@ pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordE
|
|||
}
|
||||
}
|
||||
|
||||
pub fn record_field_def(name: ast::NameRef, ty: ast::Type) -> ast::RecordField {
|
||||
pub fn record_field(name: ast::NameRef, ty: ast::Type) -> ast::RecordField {
|
||||
ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty))
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ pub fn condition(expr: ast::Expr, pattern: Option<ast::Pat>) -> ast::Condition {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn bind_pat(name: ast::Name) -> ast::IdentPat {
|
||||
pub fn ident_pat(name: ast::Name) -> ast::IdentPat {
|
||||
return from_text(name.text());
|
||||
|
||||
fn from_text(text: &str) -> ast::IdentPat {
|
||||
|
@ -156,7 +156,7 @@ pub fn bind_pat(name: ast::Name) -> ast::IdentPat {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn placeholder_pat() -> ast::WildcardPat {
|
||||
pub fn wildcard_pat() -> ast::WildcardPat {
|
||||
return from_text("_");
|
||||
|
||||
fn from_text(text: &str) -> ast::WildcardPat {
|
||||
|
@ -288,7 +288,7 @@ pub fn visibility_pub_crate() -> ast::Visibility {
|
|||
ast_from_text("pub(crate) struct S")
|
||||
}
|
||||
|
||||
pub fn fn_def(
|
||||
pub fn fn_(
|
||||
visibility: Option<ast::Visibility>,
|
||||
fn_name: ast::Name,
|
||||
type_params: Option<ast::GenericParamList>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue