From 437023c037703e1776619d75f71cc8d0b36249cd Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Mon, 26 Mar 2018 00:14:11 +0200 Subject: [PATCH] ref: cargo fmt --- src/dsn.rs | 2 +- src/lib.rs | 2 +- src/protocol/v7.rs | 28 +-- src/utils.rs | 33 ++-- tests/test_auth.rs | 8 +- tests/test_protocol_v7.rs | 404 ++++++++++++++++++++++---------------- 6 files changed, 270 insertions(+), 207 deletions(-) diff --git a/src/dsn.rs b/src/dsn.rs index abedc511..a4e649c1 100644 --- a/src/dsn.rs +++ b/src/dsn.rs @@ -4,7 +4,7 @@ use std::str::FromStr; use url::Url; use project_id::{ProjectId, ProjectIdParseError}; -use auth::{Auth, auth_from_dsn_and_client}; +use auth::{auth_from_dsn_and_client, Auth}; /// Represents a dsn url parsing error. #[derive(Debug, Fail)] diff --git a/src/lib.rs b/src/lib.rs index fc611f66..42add6d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,6 +40,7 @@ extern crate chrono; extern crate failure; #[macro_use] extern crate failure_derive; +extern crate linked_hash_map; extern crate serde; #[macro_use] extern crate serde_derive; @@ -47,7 +48,6 @@ extern crate serde_json; extern crate url; extern crate url_serde; extern crate uuid; -extern crate linked_hash_map; #[macro_use] mod macros; diff --git a/src/protocol/v7.rs b/src/protocol/v7.rs index 6dee114a..61542ae9 100644 --- a/src/protocol/v7.rs +++ b/src/protocol/v7.rs @@ -19,7 +19,7 @@ use utils::ts_seconds_float; /// An arbitrary (JSON) value (`serde_json::value::Value`) pub mod value { - pub use serde_json::value::{Map, Value, Index, Number, from_value, to_value}; + pub use serde_json::value::{from_value, to_value, Index, Map, Number, Value}; } /// The internally use arbitrary data map type (`linked_hash_map::LinkedHashMap`) @@ -27,9 +27,8 @@ pub mod value { /// It is currently backed by the `linked-hash-map` crate's hash map so that /// insertion order is preserved. pub mod map { - pub use linked_hash_map::{Entries, IntoIter, Iter, IterMut, Keys, - LinkedHashMap, OccupiedEntry, - VacantEntry, Values}; + pub use linked_hash_map::{Entries, IntoIter, Iter, IterMut, Keys, LinkedHashMap, + OccupiedEntry, VacantEntry, Values}; } /// An arbitrary (JSON) value (`serde_json::value::Value`) @@ -308,7 +307,6 @@ pub struct Thread { pub current: bool, } - /// Represents a single exception #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)] pub struct Exception { @@ -1061,16 +1059,18 @@ impl<'de> Deserialize<'de> for Addr { Uint(u64), } - Ok(Addr(match Repr::deserialize(deserializer).map_err(D::Error::custom)? { - Repr::Str(s) => { - if s.len() > 2 && (&s[..2] == "0x" || &s[..2] == "0X") { - u64::from_str_radix(&s[2..], 16).map_err(D::Error::custom)? - } else { - u64::from_str_radix(&s, 10).map_err(D::Error::custom)? + Ok(Addr( + match Repr::deserialize(deserializer).map_err(D::Error::custom)? { + Repr::Str(s) => { + if s.len() > 2 && (&s[..2] == "0x" || &s[..2] == "0X") { + u64::from_str_radix(&s[2..], 16).map_err(D::Error::custom)? + } else { + u64::from_str_radix(&s, 10).map_err(D::Error::custom)? + } } - } - Repr::Uint(val) => val - })) + Repr::Uint(val) => val, + }, + )) } } diff --git a/src/utils.rs b/src/utils.rs index 4756c3b5..10458549 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,12 +1,11 @@ -use chrono::{DateTime, Utc, TimeZone}; +use chrono::{DateTime, TimeZone, Utc}; /// Converts a datetime object into a float timestamp. pub fn datetime_to_timestamp(dt: &DateTime) -> f64 { if dt.timestamp_subsec_nanos() == 0 { dt.timestamp() as f64 } else { - (dt.timestamp() as f64) + - ((dt.timestamp_subsec_micros() as f64) / 1_000_000f64) + (dt.timestamp() as f64) + ((dt.timestamp_subsec_micros() as f64) / 1_000_000f64) } } @@ -16,30 +15,30 @@ pub fn timestamp_to_datetime(ts: f64) -> DateTime { Utc.timestamp_opt(secs, micros * 1000).unwrap() } - pub mod ts_seconds_float { use std::fmt; - use serde::{ser, de}; - use chrono::{DateTime, Utc, TimeZone}; + use serde::{de, ser}; + use chrono::{DateTime, TimeZone, Utc}; use super::timestamp_to_datetime; pub fn deserialize<'de, D>(d: D) -> Result, D::Error> - where D: de::Deserializer<'de> + where + D: de::Deserializer<'de>, { Ok(d.deserialize_any(SecondsTimestampVisitor) - .map(|dt| dt.with_timezone(&Utc))?) + .map(|dt| dt.with_timezone(&Utc))?) } pub fn serialize(dt: &DateTime, serializer: S) -> Result - where S: ser::Serializer + where + S: ser::Serializer, { if dt.timestamp_subsec_nanos() == 0 { serializer.serialize_i64(dt.timestamp()) } else { serializer.serialize_f64( - (dt.timestamp() as f64) + - ((dt.timestamp_subsec_micros() as f64) / 1_000_000f64) + (dt.timestamp() as f64) + ((dt.timestamp_subsec_micros() as f64) / 1_000_000f64), ) } } @@ -49,25 +48,27 @@ pub mod ts_seconds_float { impl<'de> de::Visitor<'de> for SecondsTimestampVisitor { type Value = DateTime; - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result - { + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { write!(formatter, "a unix timestamp") } fn visit_f64(self, value: f64) -> Result, E> - where E: de::Error + where + E: de::Error, { Ok(timestamp_to_datetime(value)) } fn visit_i64(self, value: i64) -> Result, E> - where E: de::Error + where + E: de::Error, { Ok(Utc.timestamp_opt(value, 0).unwrap()) } fn visit_u64(self, value: u64) -> Result, E> - where E: de::Error + where + E: de::Error, { Ok(Utc.timestamp_opt(value as i64, 0).unwrap()) } diff --git a/tests/test_auth.rs b/tests/test_auth.rs index 84e217b9..cd152789 100644 --- a/tests/test_auth.rs +++ b/tests/test_auth.rs @@ -1,8 +1,7 @@ extern crate chrono; extern crate sentry_types; use chrono::{TimeZone, Utc}; -use sentry_types::{Auth, Dsn, protocol}; - +use sentry_types::{protocol, Auth, Dsn}; #[test] fn test_auth_parsing() { @@ -13,7 +12,10 @@ fn test_auth_parsing() { sentry_secret=secret" .parse() .unwrap(); - assert_eq!(auth.timestamp(), Some(Utc.ymd(2012, 2, 1).and_hms_milli(0, 14, 46, 500))); + assert_eq!( + auth.timestamp(), + Some(Utc.ymd(2012, 2, 1).and_hms_milli(0, 14, 46, 500)) + ); assert_eq!(auth.client_agent(), Some("raven-python/42")); assert_eq!(auth.version(), 6); assert_eq!(auth.public_key(), "public"); diff --git a/tests/test_protocol_v7.rs b/tests/test_protocol_v7.rs index 430ab68d..e9473901 100644 --- a/tests/test_protocol_v7.rs +++ b/tests/test_protocol_v7.rs @@ -1,8 +1,9 @@ +extern crate chrono; extern crate sentry_types; extern crate serde; -#[macro_use] extern crate serde_json; +#[macro_use] +extern crate serde_json; extern crate uuid; -extern crate chrono; use chrono::{TimeZone, Utc}; @@ -172,11 +173,14 @@ fn test_repos() { let event = v7::Event { repos: { let mut m = v7::Map::new(); - m.insert("/raven".into(), v7::RepoReference { - name: "github/raven".into(), - prefix: Some("/".into()), - revision: Some("49f45700b5fe606c1bcd9bf0205ecbb83db17f52".into()), - }); + m.insert( + "/raven".into(), + v7::RepoReference { + name: "github/raven".into(), + prefix: Some("/".into()), + revision: Some("49f45700b5fe606c1bcd9bf0205ecbb83db17f52".into()), + }, + ); m }, ..Default::default() @@ -191,11 +195,14 @@ fn test_repos() { let event = v7::Event { repos: { let mut m = v7::Map::new(); - m.insert("/raven".into(), v7::RepoReference { - name: "github/raven".into(), - prefix: None, - revision: None, - }); + m.insert( + "/raven".into(), + v7::RepoReference { + name: "github/raven".into(), + prefix: None, + revision: None, + }, + ); m }, ..Default::default() @@ -235,7 +242,7 @@ fn test_user() { let mut hm = v7::Map::new(); hm.insert("foo".into(), "bar".into()); hm - } + }, }), ..Default::default() }; @@ -316,7 +323,7 @@ fn test_stacktrace() { ..Default::default() }, ..Default::default() - } + }, ], ..Default::default() }), @@ -366,7 +373,7 @@ fn test_threads() { id: Some("#1".into()), name: Some("Awesome Thread".into()), ..Default::default() - } + }, ], ..Default::default() }; @@ -385,7 +392,7 @@ fn test_threads() { crashed: true, current: true, ..Default::default() - } + }, ], ..Default::default() }; @@ -429,7 +436,7 @@ fn test_threads() { ..Default::default() }), ..Default::default() - } + }, ], ..Default::default() }; @@ -439,7 +446,7 @@ fn test_threads() { serde_json::to_string(&event).unwrap(), "{\"threads\":{\"values\":[{\"stacktrace\":{\"frames\":[{\"function\":\ \"main\",\"filename\":\"hello.py\",\"lineno\":1}]},\"raw_stacktrace\"\ - :{\"frames\":[{\"function\":\"main\",\"filename\":\"hello.py\",\"lineno\":1}]}}]}}" + :{\"frames\":[{\"function\":\"main\",\"filename\":\"hello.py\",\"lineno\":1}]}}]}}" ); } @@ -509,10 +516,7 @@ fn test_request() { }; assert_roundtrip(&event); - assert_eq!( - serde_json::to_string(&event).unwrap(), - "{\"request\":{}}" - ); + assert_eq!(serde_json::to_string(&event).unwrap(), "{\"request\":{}}"); } #[test] @@ -539,10 +543,13 @@ fn test_extra() { let event = v7::Event { extra: { let mut m = v7::Map::new(); - m.insert("component_state".into(), json!({ + m.insert( + "component_state".into(), + json!({ "dirty": true, "revision": 17 - })); + }), + ); m }, ..Default::default() @@ -592,7 +599,7 @@ fn test_debug_meta() { }), v7::DebugImage::Proguard(v7::ProguardDebugImage { uuid: "8c954262-f905-4992-8a61-f60825f4553b".parse().unwrap(), - }) + }), ], ..Default::default() }, @@ -656,26 +663,28 @@ fn test_multi_exception_list() { #[test] fn test_minimal_exception_stacktrace() { let event: v7::Event = v7::Event { - exceptions: vec![v7::Exception { - ty: "DivisionByZero".into(), - value: Some("integer division or modulo by zero".into()), - module: None, - stacktrace: Some(v7::Stacktrace { - frames: vec![ - v7::Frame { - function: Some("main".into()), - location: v7::FileLocation { - filename: Some("hello.py".into()), - line: Some(1), + exceptions: vec![ + v7::Exception { + ty: "DivisionByZero".into(), + value: Some("integer division or modulo by zero".into()), + module: None, + stacktrace: Some(v7::Stacktrace { + frames: vec![ + v7::Frame { + function: Some("main".into()), + location: v7::FileLocation { + filename: Some("hello.py".into()), + line: Some(1), + ..Default::default() + }, ..Default::default() }, - ..Default::default() - } - ], - ..Default::default() - }), - raw_stacktrace: None, - }], + ], + ..Default::default() + }), + raw_stacktrace: None, + }, + ], ..Default::default() }; @@ -692,38 +701,40 @@ fn test_minimal_exception_stacktrace() { #[test] fn test_slightly_larger_exception_stacktrace() { let event: v7::Event = v7::Event { - exceptions: vec![v7::Exception { - ty: "DivisionByZero".into(), - value: Some("integer division or modulo by zero".into()), - module: None, - stacktrace: Some(v7::Stacktrace { - frames: vec![ - v7::Frame { - function: Some("main".into()), - location: v7::FileLocation { - filename: Some("hello.py".into()), - line: Some(7), - column: Some(42), + exceptions: vec![ + v7::Exception { + ty: "DivisionByZero".into(), + value: Some("integer division or modulo by zero".into()), + module: None, + stacktrace: Some(v7::Stacktrace { + frames: vec![ + v7::Frame { + function: Some("main".into()), + location: v7::FileLocation { + filename: Some("hello.py".into()), + line: Some(7), + column: Some(42), + ..Default::default() + }, + source: v7::EmbeddedSources { + pre_lines: vec!["foo".into(), "bar".into()], + current_line: Some("hey hey hey".into()), + post_lines: vec!["foo".into(), "bar".into()], + }, + in_app: Some(true), + vars: { + let mut m = v7::Map::new(); + m.insert("var".into(), "value".into()); + m + }, ..Default::default() }, - source: v7::EmbeddedSources { - pre_lines: vec!["foo".into(), "bar".into()], - current_line: Some("hey hey hey".into()), - post_lines: vec!["foo".into(), "bar".into()], - }, - in_app: Some(true), - vars: { - let mut m = v7::Map::new(); - m.insert("var".into(), "value".into()); - m - }, - ..Default::default() - }, - ], - ..Default::default() - }), - raw_stacktrace: None, - }], + ], + ..Default::default() + }), + raw_stacktrace: None, + }, + ], ..Default::default() }; @@ -742,58 +753,60 @@ fn test_slightly_larger_exception_stacktrace() { #[test] fn test_full_exception_stacktrace() { let event: v7::Event = v7::Event { - exceptions: vec![v7::Exception { - ty: "DivisionByZero".into(), - value: Some("integer division or modulo by zero".into()), - module: Some("x".into()), - stacktrace: Some(v7::Stacktrace { - frames: vec![ - v7::Frame { - function: Some("main".into()), - symbol: Some("main".into()), - location: v7::FileLocation { - filename: Some("hello.py".into()), - abs_path: Some("/app/hello.py".into()), - line: Some(7), - column: Some(42), - }, - source: v7::EmbeddedSources { - pre_lines: vec!["foo".into(), "bar".into()], - current_line: Some("hey hey hey".into()), - post_lines: vec!["foo".into(), "bar".into()], - }, - in_app: Some(true), - vars: { - let mut m = v7::Map::new(); - m.insert("var".into(), "value".into()); - m + exceptions: vec![ + v7::Exception { + ty: "DivisionByZero".into(), + value: Some("integer division or modulo by zero".into()), + module: Some("x".into()), + stacktrace: Some(v7::Stacktrace { + frames: vec![ + v7::Frame { + function: Some("main".into()), + symbol: Some("main".into()), + location: v7::FileLocation { + filename: Some("hello.py".into()), + abs_path: Some("/app/hello.py".into()), + line: Some(7), + column: Some(42), + }, + source: v7::EmbeddedSources { + pre_lines: vec!["foo".into(), "bar".into()], + current_line: Some("hey hey hey".into()), + post_lines: vec!["foo".into(), "bar".into()], + }, + in_app: Some(true), + vars: { + let mut m = v7::Map::new(); + m.insert("var".into(), "value".into()); + m + }, + package: Some("hello.whl".into()), + module: Some("hello".into()), + instruction_info: v7::InstructionInfo { + image_addr: Some(v7::Addr(0)), + instruction_addr: Some(v7::Addr(0)), + symbol_addr: Some(v7::Addr(0)), + }, }, - package: Some("hello.whl".into()), - module: Some("hello".into()), - instruction_info: v7::InstructionInfo { - image_addr: Some(v7::Addr(0)), - instruction_addr: Some(v7::Addr(0)), - symbol_addr: Some(v7::Addr(0)), - } - }, - ], - frames_omitted: Some((1, 2)), - }), - raw_stacktrace: Some(v7::Stacktrace { - frames: vec![ - v7::Frame { - function: Some("main".into()), - instruction_info: v7::InstructionInfo { - image_addr: Some(v7::Addr(0)), - instruction_addr: Some(v7::Addr(0)), - symbol_addr: Some(v7::Addr(0)), + ], + frames_omitted: Some((1, 2)), + }), + raw_stacktrace: Some(v7::Stacktrace { + frames: vec![ + v7::Frame { + function: Some("main".into()), + instruction_info: v7::InstructionInfo { + image_addr: Some(v7::Addr(0)), + instruction_addr: Some(v7::Addr(0)), + symbol_addr: Some(v7::Addr(0)), + }, + ..Default::default() }, - ..Default::default() - }, - ], - frames_omitted: Some((1, 2)), - }), - }], + ], + frames_omitted: Some((1, 2)), + }), + }, + ], ..Default::default() }; @@ -802,15 +815,15 @@ fn test_full_exception_stacktrace() { serde_json::to_string(&event).unwrap(), "{\"exception\":{\"values\":[{\"type\":\"DivisionByZero\",\"value\":\ \"integer division or modulo by zero\",\"module\":\"x\",\"stacktrace\":\ - {\"frames\":[{\"function\":\"main\",\"symbol\":\"main\",\"module\":\ - \"hello\",\"package\":\"hello.whl\",\"filename\":\"hello.py\",\"abs_path\"\ - :\"/app/hello.py\",\"lineno\":7,\"colno\":42,\"pre_context\":[\"foo\",\"\ - bar\"],\"context_line\":\"hey hey hey\",\"post_context\":[\"foo\",\"bar\"]\ - ,\"in_app\":true,\"vars\":{\"var\":\"value\"},\"image_addr\":\"0x0\",\ - \"instruction_addr\":\"0x0\",\"symbol_addr\":\"0x0\"}],\"frames_omitted\":\ - [1,2]},\"raw_stacktrace\":{\"frames\":[{\"function\":\"main\",\ - \"image_addr\":\"0x0\",\"instruction_addr\":\"0x0\",\"symbol_addr\":\"0x0\"}\ - ],\"frames_omitted\":[1,2]}}]}}" + {\"frames\":[{\"function\":\"main\",\"symbol\":\"main\",\"module\":\ + \"hello\",\"package\":\"hello.whl\",\"filename\":\"hello.py\",\"abs_path\"\ + :\"/app/hello.py\",\"lineno\":7,\"colno\":42,\"pre_context\":[\"foo\",\"\ + bar\"],\"context_line\":\"hey hey hey\",\"post_context\":[\"foo\",\"bar\"]\ + ,\"in_app\":true,\"vars\":{\"var\":\"value\"},\"image_addr\":\"0x0\",\ + \"instruction_addr\":\"0x0\",\"symbol_addr\":\"0x0\"}],\"frames_omitted\":\ + [1,2]},\"raw_stacktrace\":{\"frames\":[{\"function\":\"main\",\ + \"image_addr\":\"0x0\",\"instruction_addr\":\"0x0\",\"symbol_addr\":\"0x0\"}\ + ],\"frames_omitted\":[1,2]}}]}}" ); } @@ -859,37 +872,51 @@ fn test_contexts() { let event = v7::Event { contexts: { let mut m = v7::Map::new(); - m.insert("device".into(), v7::ContextType::Device(v7::DeviceContext { - name: Some("iphone".into()), - family: Some("iphone".into()), - model: Some("iphone7,3".into()), - model_id: Some("AH223".into()), - arch: Some("arm64".into()), - battery_level: Some(58.5.into()), - orientation: Some(v7::Orientation::Landscape), - }.into()).into()); - m.insert("os".into(), v7::ContextType::Os(v7::OsContext { - name: Some("iOS".into()), - version: Some("11.4.2".into()), - build: Some("ADSA23".into()), - kernel_version: Some("17.4.0".into()), - rooted: Some(true), - }).into()); - m.insert("magicvm".into(), v7::ContextType::Runtime(v7::RuntimeContext { - name: Some("magicvm".into()), - version: Some("5.3".into()), - }).into()); - m.insert("othervm".into(), v7::Context { - data: v7::ContextType::Runtime(v7::RuntimeContext { + m.insert( + "device".into(), + v7::ContextType::Device( + v7::DeviceContext { + name: Some("iphone".into()), + family: Some("iphone".into()), + model: Some("iphone7,3".into()), + model_id: Some("AH223".into()), + arch: Some("arm64".into()), + battery_level: Some(58.5.into()), + orientation: Some(v7::Orientation::Landscape), + }.into(), + ).into(), + ); + m.insert( + "os".into(), + v7::ContextType::Os(v7::OsContext { + name: Some("iOS".into()), + version: Some("11.4.2".into()), + build: Some("ADSA23".into()), + kernel_version: Some("17.4.0".into()), + rooted: Some(true), + }).into(), + ); + m.insert( + "magicvm".into(), + v7::ContextType::Runtime(v7::RuntimeContext { name: Some("magicvm".into()), version: Some("5.3".into()), - }), - extra: { - let mut m = v7::Map::new(); - m.insert("extra_stuff".into(), "extra_value".into()); - m - } - }); + }).into(), + ); + m.insert( + "othervm".into(), + v7::Context { + data: v7::ContextType::Runtime(v7::RuntimeContext { + name: Some("magicvm".into()), + version: Some("5.3".into()), + }), + extra: { + let mut m = v7::Map::new(); + m.insert("extra_stuff".into(), "extra_value".into()); + m + }, + }, + ); m }, ..Default::default() @@ -914,12 +941,30 @@ fn test_addr_format() { assert_eq!(serde_json::to_string(&v7::Addr(0)).unwrap(), "\"0x0\""); assert_eq!(serde_json::to_string(&v7::Addr(42)).unwrap(), "\"0x2a\""); assert_eq!(serde_json::from_str::("0").unwrap(), v7::Addr(0)); - assert_eq!(serde_json::from_str::("\"0\"").unwrap(), v7::Addr(0)); - assert_eq!(serde_json::from_str::("\"0x0\"").unwrap(), v7::Addr(0)); - assert_eq!(serde_json::from_str::("42").unwrap(), v7::Addr(42)); - assert_eq!(serde_json::from_str::("\"42\"").unwrap(), v7::Addr(42)); - assert_eq!(serde_json::from_str::("\"0x2a\"").unwrap(), v7::Addr(42)); - assert_eq!(serde_json::from_str::("\"0X2A\"").unwrap(), v7::Addr(42)); + assert_eq!( + serde_json::from_str::("\"0\"").unwrap(), + v7::Addr(0) + ); + assert_eq!( + serde_json::from_str::("\"0x0\"").unwrap(), + v7::Addr(0) + ); + assert_eq!( + serde_json::from_str::("42").unwrap(), + v7::Addr(42) + ); + assert_eq!( + serde_json::from_str::("\"42\"").unwrap(), + v7::Addr(42) + ); + assert_eq!( + serde_json::from_str::("\"0x2a\"").unwrap(), + v7::Addr(42) + ); + assert_eq!( + serde_json::from_str::("\"0X2A\"").unwrap(), + v7::Addr(42) + ); } #[test] @@ -934,13 +979,28 @@ fn test_addr_api() { fn test_thread_id_format() { assert_eq!(serde_json::to_string(&v7::ThreadId::Int(0)).unwrap(), "0"); assert_eq!(serde_json::to_string(&v7::ThreadId::Int(42)).unwrap(), "42"); - assert_eq!(serde_json::to_string(&v7::ThreadId::String("x".into())).unwrap(), "\"x\""); - assert_eq!(serde_json::from_str::("0").unwrap(), v7::ThreadId::Int(0)); - assert_eq!(serde_json::from_str::("\"0\"").unwrap(), v7::ThreadId::String("0".into())); + assert_eq!( + serde_json::to_string(&v7::ThreadId::String("x".into())).unwrap(), + "\"x\"" + ); + assert_eq!( + serde_json::from_str::("0").unwrap(), + v7::ThreadId::Int(0) + ); + assert_eq!( + serde_json::from_str::("\"0\"").unwrap(), + v7::ThreadId::String("0".into()) + ); } #[test] fn test_orientation() { - assert_eq!(serde_json::to_string(&v7::Orientation::Landscape).unwrap(), "\"landscape\""); - assert_eq!(serde_json::to_string(&v7::Orientation::Portrait).unwrap(), "\"portrait\""); + assert_eq!( + serde_json::to_string(&v7::Orientation::Landscape).unwrap(), + "\"landscape\"" + ); + assert_eq!( + serde_json::to_string(&v7::Orientation::Portrait).unwrap(), + "\"portrait\"" + ); }