| 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_innerrust-analyzer cargo enum-as-inner 0.6.1 crate/::EnumAsInnerrust-analyzer cargo enum-as-inner 0.6.1 EnumAsInner:; |
| 16 | |
| 17 | pub mod name_collisionsrust-analyzer cargo enum-as-inner 0.6.1 name_collisions/ { |
| 18 | #![allow(dead_code, missing_copy_implementations, missing_docs)] |
| 19 | pub struct Optionrust-analyzer cargo enum-as-inner 0.6.1 name_collisions/Option#; |
| 20 | pub struct Somerust-analyzer cargo enum-as-inner 0.6.1 name_collisions/Some#; |
| 21 | pub struct Nonerust-analyzer cargo enum-as-inner 0.6.1 name_collisions/None#; |
| 22 | pub struct Resultrust-analyzer cargo enum-as-inner 0.6.1 name_collisions/Result#; |
| 23 | pub struct Okrust-analyzer cargo enum-as-inner 0.6.1 name_collisions/Ok#; |
| 24 | pub struct Errrust-analyzer cargo enum-as-inner 0.6.1 name_collisions/Err#; |
| 25 | } |
| 26 | #[allow(unused_imports)] |
| 27 | use name_collisionsrust-analyzer cargo enum-as-inner 0.6.1 name_collisions/::*; |
| 28 | |
| 29 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, EnumAsInnerrust-analyzer cargo enum-as-inner 0.6.1 EnumAsInner:)] |
| 30 | enum EmptyTestrust-analyzer cargo enum-as-inner 0.6.1 EmptyTest# {} |
| 31 | |
| 32 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 33 | fn test_emptyrust-analyzer cargo enum-as-inner 0.6.1 test_empty().() { |
| 34 | let empty = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/::Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#::Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#::<EmptyTestrust-analyzer cargo enum-as-inner 0.6.1 EmptyTest#>; |
| 35 | |
| 36 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(empty.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()); |
| 37 | } |
| 38 | |
| 39 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, EnumAsInnerrust-analyzer cargo enum-as-inner 0.6.1 EnumAsInner:)] |
| 40 | enum EmptyParendsTestrust-analyzer cargo enum-as-inner 0.6.1 EmptyParendsTest# { |
| 41 | Emptyrust-analyzer cargo enum-as-inner 0.6.1 EmptyParendsTest#Empty#(), |
| 42 | } |
| 43 | |
| 44 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 45 | fn test_empty_parendsrust-analyzer cargo enum-as-inner 0.6.1 test_empty_parends().() { |
| 46 | let mut empty = EmptyParendsTestrust-analyzer cargo enum-as-inner 0.6.1 EmptyParendsTest#::Emptyrust-analyzer cargo enum-as-inner 0.6.1 EmptyParendsTest#Empty#(); |
| 47 | |
| 48 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(empty.is_emptyrust-analyzer cargo enum-as-inner 0.6.1 impl#[EmptyParendsTest]is_empty().()); |
| 49 | |
| 50 | empty |
| 51 | .as_emptyrust-analyzer cargo enum-as-inner 0.6.1 impl#[EmptyParendsTest]as_empty().() |
| 52 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("should have been something and a unit"); |
| 53 | empty |
| 54 | .as_empty_mutrust-analyzer cargo enum-as-inner 0.6.1 impl#[EmptyParendsTest]as_empty_mut().() |
| 55 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("should have been something and a unit"); |
| 56 | |
| 57 | empty |
| 58 | .into_emptyrust-analyzer cargo enum-as-inner 0.6.1 impl#[EmptyParendsTest]into_empty().() |
| 59 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("should have been something and a unit"); |
| 60 | } |
| 61 | |
| 62 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, EnumAsInnerrust-analyzer cargo enum-as-inner 0.6.1 EnumAsInner:)] |
| 63 | enum OneTestrust-analyzer cargo enum-as-inner 0.6.1 OneTest# { |
| 64 | Onerust-analyzer cargo enum-as-inner 0.6.1 OneTest#One#(u32), |
| 65 | } |
| 66 | |
| 67 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 68 | fn test_onerust-analyzer cargo enum-as-inner 0.6.1 test_one().() { |
| 69 | let mut empty = OneTestrust-analyzer cargo enum-as-inner 0.6.1 OneTest#::Onerust-analyzer cargo enum-as-inner 0.6.1 OneTest#One#(1); |
| 70 | |
| 71 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(empty.is_onerust-analyzer cargo enum-as-inner 0.6.1 impl#[OneTest]is_one().()); |
| 72 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().empty.as_onerust-analyzer cargo enum-as-inner 0.6.1 impl#[OneTest]as_one().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1); |
| 73 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().empty.as_one_mutrust-analyzer cargo enum-as-inner 0.6.1 impl#[OneTest]as_one_mut().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), 1); |
| 74 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(empty.into_onerust-analyzer cargo enum-as-inner 0.6.1 impl#[OneTest]into_one().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), 1); |
| 75 | } |
| 76 | |
| 77 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, EnumAsInnerrust-analyzer cargo enum-as-inner 0.6.1 EnumAsInner:)] |
| 78 | enum MultiTestrust-analyzer cargo enum-as-inner 0.6.1 MultiTest# { |
| 79 | Multirust-analyzer cargo enum-as-inner 0.6.1 MultiTest#Multi#(u32, u32), |
| 80 | } |
| 81 | |
| 82 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 83 | fn test_multirust-analyzer cargo enum-as-inner 0.6.1 test_multi().() { |
| 84 | let mut multi = MultiTestrust-analyzer cargo enum-as-inner 0.6.1 MultiTest#::Multirust-analyzer cargo enum-as-inner 0.6.1 MultiTest#Multi#(1, 1); |
| 85 | |
| 86 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(multi.is_multirust-analyzer cargo enum-as-inner 0.6.1 impl#[MultiTest]is_multi().()); |
| 87 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(multi.as_multirust-analyzer cargo enum-as-inner 0.6.1 impl#[MultiTest]as_multi().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), (&1_u32, &1_u32)); |
| 88 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(multi.as_multi_mutrust-analyzer cargo enum-as-inner 0.6.1 impl#[MultiTest]as_multi_mut().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), (&mut 1_u32, &mut 1_u32)); |
| 89 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(multi.into_multirust-analyzer cargo enum-as-inner 0.6.1 impl#[MultiTest]into_multi().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), (1_u32, 1_u32)); |
| 90 | } |