Bad practice

Clippy also gives us lints that will detect bad coding practices. You should, for example, not import enumeration variants, since enumeration variants should always be prefixed with the actual enumeration. To lint against this practice, you can use the enum_glob_use lint.

Other code practices that might create issues are the panicking From and Into trait implementations. By definition, these traits must never fail, and using unwrap(), expect(), panic!(), or assert!() functions and macros can panic the function. This can be the desired behavior in an application, even though it's bad practice (you should use TryInto and TryFrom traits, or create a new function if developing with the stable compiler).

But the main issue is when ...

Get Rust High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.