Downgrade to 2018 edition (support rust-analyzer)
This commit is contained in:
+2
-5
@@ -51,15 +51,14 @@ where
|
||||
|
||||
impl Event {
|
||||
pub fn parse(json: &str) -> Result<Event> {
|
||||
let e: Event = serde_json::from_str(json)?;
|
||||
let _e: Event = serde_json::from_str(json)?;
|
||||
Err(Error::EventParseFailed)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::event::Event;
|
||||
use serde_json::Result;
|
||||
use super::*;
|
||||
fn simple_event() -> Event {
|
||||
super::Event {
|
||||
id: 0,
|
||||
@@ -112,7 +111,6 @@ mod tests {
|
||||
#[test]
|
||||
fn event_deserialize() -> Result<()> {
|
||||
let raw_json = r#"{"id":"1384757da583e6129ce831c3d7afc775a33a090578f888dd0d010328ad047d0c","pubkey":"bbbd9711d357df4f4e498841fd796535c95c8e751fa35355008a911c41265fca","created_at":1612650459,"kind":1,"tags":null,"content":"hello world","sig":"59d0cc47ab566e81f72fe5f430bcfb9b3c688cb0093d1e6daa49201c00d28ecc3651468b7938642869ed98c0f1b262998e49a05a6ed056c0d92b193f4e93bc21"}"#;
|
||||
|
||||
// id: 1384757da583e6129ce831c3d7afc775a33a090578f888dd0d010328ad047d0c
|
||||
// pubkey: bbbd9711d357df4f4e498841fd796535c95c8e751fa35355008a911c41265fca",
|
||||
// created_at: 1612650459
|
||||
@@ -120,7 +118,6 @@ mod tests {
|
||||
// tags":null,
|
||||
// "content":"hello world",
|
||||
// "sig":"59d0cc47ab566e81f72fe5f430bcfb9b3c688cb0093d1e6daa49201c00d28ecc3651468b7938642869ed98c0f1b262998e49a05a6ed056c0d92b193f4e93bc21"}]"#;
|
||||
|
||||
let e: Event = serde_json::from_str(raw_json)?;
|
||||
// assert that the kind is 1
|
||||
assert_eq!(e.kind, 1);
|
||||
|
||||
Reference in New Issue
Block a user