Closed as duplicate of#93187
Closed as duplicate of#93187
Description
Problem
Kaspersky rejected your run doctest and warned you that it is virus
I remember everything was normal yesterday ☠️
Steps
1.run doctest
user\.cargo\bin\cargo.exe test --doc --package bilibulu_lib -- utils::de_empty_string_to_none --show-output
my doctest code:
/// 将空 `String` ("") 反序列化为 `None`
/// # Example
/// ```
/// use serde::Deserialize;
/// use serde_json;
/// use bilibulu_lib::utils::de_empty_string_to_none;
///
/// #[derive(Debug, Deserialize)]
/// struct Foo {
/// #[serde(deserialize_with = "de_empty_string_to_none")]
/// bar: Option<String>,
/// }
///
/// let json = r#"{ "bar": "" }"#;
/// let data: Foo = serde_json::from_str(json).unwrap();
/// assert!(data.bar.is_none());
///
/// let json = r#"{ "bar": null }"#;
/// let data: Foo = serde_json::from_str(json).unwrap();
/// assert!(data.bar.is_none());
///
/// let json = r#"{ "bar": "something here" }"#;
/// let data: Foo = serde_json::from_str(json).unwrap();
/// assert_eq!(data.bar, Some(String::from("something here")));
/// ```
pub fn de_empty_string_to_none<'de, D>(deserializer: D) -> Result<Option<String>, D::Error>
where
D: Deserializer<'de>
{
let str: Option<String> = Option::deserialize(deserializer)?;
match str {
// `str` 为 空("") 时
Some(s) if s.is_empty() => Ok(None),
// 缺少该字段时
None => Ok(None),
Some(s) => Ok(Some(s))
}
}
2.output
Couldn't run the test: Access is denied. (os error 5) - maybe your tempdir is mounted with noexec?
Kaspersky rejected the run doctest and warned that it is virus:
VHO: Trojan-Spy.Win64.KeyLogger.gen
object: C:\Users\xxx\AppData\Local\Temp\rustdoctestjIysfn\rust_out.exe
kaspersky - Trojan-Spy.Win64.KeyLogger.gen details
Possible Solution(s)
No response
Notes
No response
Version