1 // Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
10 fn input(_: Option<Option<u8>>) {}
12 fn output() -> Option<Option<u8>> {
16 fn output_nested() -> Vec<Option<Option<u8>>> {
20 // The lint only generates one warning for this
21 fn output_nested_nested() -> Option<Option<Option<u8>>> {
26 x: Option<Option<u8>>,
30 fn struct_fn() -> Option<Option<u8>> {
36 fn trait_fn() -> Option<Option<u8>>;
40 Tuple(Option<Option<u8>>),
41 Struct { x: Option<Option<u8>> },
44 // The lint allows this
45 type OptionOption = Option<Option<u32>>;
47 // The lint allows this
48 fn output_type_alias() -> OptionOption {
52 // The line allows this
53 impl Trait for Struct {
54 fn trait_fn() -> Option<Option<u8>> {
64 // The lint allows this
65 let local: Option<Option<u8>> = None;
67 // The lint allows this
68 let expr = Some(Some(true));