| 1 | #![warn( |
| 2 | clippy::default_trait_access, |
| 3 | clippy::dbg_macro, |
| 4 | clippy::print_stdout, |
| 5 | clippy::unimplemented, |
| 6 | clippy::use_self, |
| 7 | missing_copy_implementations, |
| 8 | missing_docs, |
| 9 | non_snake_case, |
| 10 | non_upper_case_globals, |
| 11 | rust_2018_idioms, |
| 12 | unreachable_pub |
| 13 | )] |
| 14 | |
| 15 | use enum_as_inner::EnumAsInner; |
| 16 | |
| 17 | pub mod name_collisions { |
| 18 | #![allow(dead_code, missing_copy_implementations, missing_docs)] |
| 19 | pub struct Option; |
| 20 | pub struct Some; |
| 21 | pub struct None; |
| 22 | pub struct Result; |
| 23 | pub struct Ok; |
| 24 | pub struct Err; |
| 25 | } |
| 26 | #[allow(unused_imports)] |
| 27 | use name_collisions::*; |
| 28 | |
| 29 | #[derive(EnumAsInner)] |
| 30 | enum UnitVariants { |
| 31 | Zero, |
| 32 | One, |
| 33 | Two, |
| 34 | } |
| 35 | |
| 36 | #[test] |
| 37 | fn test_zero_unit() { |
| 38 | let unit = UnitVariants::Zero; |
| 39 | |
| 40 | assert!(unit.is_zero()); |
| 41 | assert!(!unit.is_one()); |
| 42 | assert!(!unit.is_two()); |
| 43 | } |
| 44 | |
| 45 | #[test] |
| 46 | fn test_one_unit() { |
| 47 | let unit = UnitVariants::One; |
| 48 | |
| 49 | assert!(!unit.is_zero()); |
| 50 | assert!(unit.is_one()); |
| 51 | assert!(!unit.is_two()); |
| 52 | } |
| 53 | |
| 54 | #[test] |
| 55 | fn test_two_unit() { |
| 56 | let unit = UnitVariants::Two; |
| 57 | |
| 58 | assert!(!unit.is_zero()); |
| 59 | assert!(!unit.is_one()); |
| 60 | assert!(unit.is_two()); |
| 61 | } |