1 #![deny(clippy::option_option)]
2 #![allow(clippy::unnecessary_wraps)]
4 fn input(_: Option<Option<u8>>) {}
6 fn output() -> Option<Option<u8>> {
10 fn output_nested() -> Vec<Option<Option<u8>>> {
14 // The lint only generates one warning for this
15 fn output_nested_nested() -> Option<Option<Option<u8>>> {
20 x: Option<Option<u8>>,
24 fn struct_fn() -> Option<Option<u8>> {
30 fn trait_fn() -> Option<Option<u8>>;
34 Tuple(Option<Option<u8>>),
35 Struct { x: Option<Option<u8>> },
38 // The lint allows this
39 type OptionOption = Option<Option<u32>>;
41 // The lint allows this
42 fn output_type_alias() -> OptionOption {
46 // The line allows this
47 impl Trait for Struct {
48 fn trait_fn() -> Option<Option<u8>> {
58 // The lint allows this
59 let local: Option<Option<u8>> = None;
61 // The lint allows this
62 let expr = Some(Some(true));
67 use serde::{Deserialize, Deserializer, Serialize};
70 #[derive(Serialize, Deserialize)]
72 #[serde(deserialize_with = "func")]
73 #[serde(skip_serializing_if = "Option::is_none")]
76 foo: Option<Option<Cow<'a, str>>>,
79 #[allow(clippy::option_option)]
80 fn func<'a, D>(_: D) -> Result<Option<Option<Cow<'a, str>>>, D::Error>
84 Ok(Some(Some(Cow::Borrowed("hi"))))