diff --git a/tests/ui/option_option.rs b/tests/ui/option_option.rs
index 904c50e1403..a2617a13eca 100644
--- a/tests/ui/option_option.rs
+++ b/tests/ui/option_option.rs
@@ -60,3 +60,28 @@ fn main() {
// The lint allows this
let expr = Some(Some(true));
}
+
+extern crate serde;
+mod issue_4298 {
+ use serde::{Deserialize, Deserializer, Serialize};
+ use std::borrow::Cow;
+
+ #[derive(Serialize, Deserialize)]
+ struct Foo<'a> {
+ #[serde(deserialize_with = "func")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[serde(default)]
+ #[serde(borrow)]
+ // FIXME: should not lint here
+ #[allow(clippy::option_option)]
+ foo: Option