rust-lang/rust-clippy

Manual assert_eq! (enhance `if_then_panic`)

Open

#7,716 建立於 2021年9月24日

在 GitHub 查看
 (7 留言) (0 反應) (1 負責人)Rust (1,391 fork)batch import
C-enhancementgood first issue

倉庫指標

Star
 (10,406 star)
PR 合併指標
 (平均合併 19天 22小時) (30 天內合併 113 個 PR)

描述

We just added if_then_panic, but then I realized there's a possible enhancement for assert_eq!/assert_ne!:

// before
if a != b {
    panic!("hi");
}
// after
assert_eq!(a, b, "hi");

I think a rename to manual_assert would be best. But we could also keep the current name (it still kinda makes sense) or create a new lint for this case.

貢獻者指南