Added further tests

This commit is contained in:
Michael Wright 2018-01-19 08:10:09 +02:00
parent fca248957b
commit 79c6c60f51
2 changed files with 34 additions and 5 deletions

View file

@ -18,6 +18,16 @@ struct Struct {
x: Option<Option<u8>>,
}
impl Struct {
fn struct_fn() -> Option<Option<u8>> {
None
}
}
trait Trait {
fn trait_fn() -> Option<Option<u8>>;
}
enum Enum {
Tuple(Option<Option<u8>>),
Struct{x: Option<Option<u8>>},
@ -31,6 +41,13 @@ fn output_type_alias() -> OptionOption {
None
}
// The line allows this
impl Trait for Struct {
fn trait_fn() -> Option<Option<u8>> {
None
}
}
fn main() {
input(None);
output();

View file

@ -31,16 +31,28 @@ error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enu
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:22:11
--> $DIR/option_option.rs:22:23
|
22 | Tuple(Option<Option<u8>>),
22 | fn struct_fn() -> Option<Option<u8>> {
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:28:22
|
28 | fn trait_fn() -> Option<Option<u8>>;
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:32:11
|
32 | Tuple(Option<Option<u8>>),
| ^^^^^^^^^^^^^^^^^^
error: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> $DIR/option_option.rs:23:15
--> $DIR/option_option.rs:33:15
|
23 | Struct{x: Option<Option<u8>>},
33 | Struct{x: Option<Option<u8>>},
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 7 previous errors
error: aborting due to 9 previous errors