Skip to content

Commit 957f3b9

Browse files
lowrfasterthanlime
authored andcommitted
Replace debug_assert! with stdx::always!
1 parent 75bbbd5 commit 957f3b9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tools/rust-analyzer/crates/ide-assists/src/utils/gen_trait_fn_body.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(crate) fn gen_trait_fn_body(
2828

2929
/// Generate a `Clone` impl based on the fields and members of the target type.
3030
fn gen_clone_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
31-
debug_assert!(func.name().map_or(false, |name| name.text() == "clone"));
31+
stdx::always!(func.name().map_or(false, |name| name.text() == "clone"));
3232
fn gen_clone_call(target: ast::Expr) -> ast::Expr {
3333
let method = make::name_ref("clone");
3434
make::expr_method_call(target, method, make::arg_list(None))
@@ -340,7 +340,7 @@ fn gen_default_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
340340

341341
/// Generate a `Hash` impl based on the fields and members of the target type.
342342
fn gen_hash_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
343-
debug_assert!(func.name().map_or(false, |name| name.text() == "hash"));
343+
stdx::always!(func.name().map_or(false, |name| name.text() == "hash"));
344344
fn gen_hash_call(target: ast::Expr) -> ast::Stmt {
345345
let method = make::name_ref("hash");
346346
let arg = make::expr_path(make::ext::ident_path("state"));
@@ -396,7 +396,7 @@ fn gen_hash_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
396396

397397
/// Generate a `PartialEq` impl based on the fields and members of the target type.
398398
fn gen_partial_eq(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
399-
debug_assert!(func.name().map_or(false, |name| name.text() == "eq"));
399+
stdx::always!(func.name().map_or(false, |name| name.text() == "eq"));
400400
fn gen_eq_chain(expr: Option<ast::Expr>, cmp: ast::Expr) -> Option<ast::Expr> {
401401
match expr {
402402
Some(expr) => Some(make::expr_bin_op(expr, BinaryOp::LogicOp(LogicOp::And), cmp)),
@@ -573,7 +573,7 @@ fn gen_partial_eq(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
573573
}
574574

575575
fn gen_partial_ord(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
576-
debug_assert!(func.name().map_or(false, |name| name.text() == "partial_cmp"));
576+
stdx::always!(func.name().map_or(false, |name| name.text() == "partial_cmp"));
577577
fn gen_partial_eq_match(match_target: ast::Expr) -> Option<ast::Stmt> {
578578
let mut arms = vec![];
579579

0 commit comments

Comments
 (0)