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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user