2018-07-28 15:34:52 +00:00
|
|
|
#![warn(clippy::serde_api_misuse)]
|
2016-07-12 15:36:11 +00:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
extern crate serde;
|
|
|
|
|
|
|
|
struct A;
|
|
|
|
|
2017-05-09 13:23:10 +00:00
|
|
|
impl<'de> serde::de::Visitor<'de> for A {
|
2016-07-12 15:36:11 +00:00
|
|
|
type Value = ();
|
2017-01-24 10:31:42 +00:00
|
|
|
|
|
|
|
fn expecting(&self, _: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn visit_str<E>(self, _v: &str) -> Result<Self::Value, E>
|
2018-12-09 22:26:16 +00:00
|
|
|
where
|
|
|
|
E: serde::de::Error,
|
2016-07-12 15:36:11 +00:00
|
|
|
{
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
2017-01-24 10:31:42 +00:00
|
|
|
fn visit_string<E>(self, _v: String) -> Result<Self::Value, E>
|
2018-12-09 22:26:16 +00:00
|
|
|
where
|
|
|
|
E: serde::de::Error,
|
2016-07-12 15:36:11 +00:00
|
|
|
{
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct B;
|
|
|
|
|
2017-05-09 13:23:10 +00:00
|
|
|
impl<'de> serde::de::Visitor<'de> for B {
|
2016-07-12 15:36:11 +00:00
|
|
|
type Value = ();
|
|
|
|
|
2017-01-24 10:31:42 +00:00
|
|
|
fn expecting(&self, _: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn visit_string<E>(self, _v: String) -> Result<Self::Value, E>
|
2023-08-24 19:32:12 +00:00
|
|
|
//~^ ERROR: you should not implement `visit_string` without also implementing `visit_s
|
|
|
|
//~| NOTE: `-D clippy::serde-api-misuse` implied by `-D warnings`
|
2018-12-09 22:26:16 +00:00
|
|
|
where
|
|
|
|
E: serde::de::Error,
|
2016-07-12 15:36:11 +00:00
|
|
|
{
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
2019-05-20 10:31:53 +00:00
|
|
|
|
2018-12-09 22:26:16 +00:00
|
|
|
fn main() {}
|