rust-lang/rust-clippy

Manual assert_eq! (enhance `if_then_panic`)

Open

#7716 aperta il 24 set 2021

Vedi su GitHub
 (7 commenti) (0 reazioni) (1 assegnatario)Rust (1391 fork)batch import
C-enhancementgood first issue

Metriche repository

Star
 (10.406 star)
Metriche merge PR
 (Merge medio 19g 22h) (113 PR mergiate in 30 g)

Descrizione

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.

Guida contributor