mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
add better default behavior on fill struct fields diagnostic
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
parent
df6fa50f92
commit
336c899a07
6 changed files with 123 additions and 13 deletions
|
@ -59,8 +59,27 @@ pub mod ext {
|
|||
pub fn expr_todo() -> ast::Expr {
|
||||
expr_from_text("todo!()")
|
||||
}
|
||||
pub fn expr_default() -> ast::Expr {
|
||||
expr_from_text("Default::default()")
|
||||
pub fn expr_ty_default(ty: &ast::Type) -> ast::Expr {
|
||||
expr_from_text(&format!("{}::default()", ty))
|
||||
}
|
||||
pub fn expr_ty_new(ty: &ast::Type) -> ast::Expr {
|
||||
expr_from_text(&format!("{}::new()", ty))
|
||||
}
|
||||
|
||||
pub fn zero_number() -> ast::Expr {
|
||||
expr_from_text("0")
|
||||
}
|
||||
pub fn zero_float() -> ast::Expr {
|
||||
expr_from_text("0.0")
|
||||
}
|
||||
pub fn empty_str() -> ast::Expr {
|
||||
expr_from_text(r#""""#)
|
||||
}
|
||||
pub fn empty_char() -> ast::Expr {
|
||||
expr_from_text("''")
|
||||
}
|
||||
pub fn default_bool() -> ast::Expr {
|
||||
expr_from_text("false")
|
||||
}
|
||||
pub fn empty_block_expr() -> ast::BlockExpr {
|
||||
block_expr(None, None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue