Skip to content

Commit

Permalink
rebase + minor cleanup#1
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav-bhatt committed Jan 26, 2021
1 parent aa7cfb1 commit 40d8f4f
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 21 deletions.
5 changes: 2 additions & 3 deletions src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ pub mod url {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let ParseError::Error(v) = self {
Ok(())
}
else{
Err(fmt::Error{})
} else {
Err(fmt::Error {})
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/event/spec_version.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use super::{v03, v10};
use serde::export::Formatter;
use snafu::Snafu;
use std::convert::TryFrom;
use std::fmt;
use std::fmt::Formatter;
Expand Down
4 changes: 2 additions & 2 deletions tests/attributes_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use cloudevents::event::AttributeValue;
use cloudevents::event::SpecVersion;
use test_data::*;

#[cfg(feature="std")]
#[cfg(feature = "std")]
#[test]
fn iter_v10_test() {
let in_event = v10::full_no_data();
Expand All @@ -15,7 +15,7 @@ fn iter_v10_test() {
);
}

#[cfg(feature="std")]
#[cfg(feature = "std")]
#[test]
fn iter_v03_test() {
let in_event = v03::full_json_data();
Expand Down
8 changes: 4 additions & 4 deletions tests/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cloudevents::{AttributesReader, EventBuilder, EventBuilderV03, EventBuilderV
use std::convert::TryInto;
use test_data::*;

#[cfg(feature="std")]
#[cfg(feature = "std")]
#[test]
fn message_v03_roundtrip_structured() -> Result<()> {
assert_eq!(
Expand All @@ -15,7 +15,7 @@ fn message_v03_roundtrip_structured() -> Result<()> {
Ok(())
}

#[cfg(feature="std")]
#[cfg(feature = "std")]
#[test]
fn message_v03_roundtrip_binary() -> Result<()> {
//TODO this code smells because we're missing a proper way in the public APIs
Expand All @@ -35,7 +35,7 @@ fn message_v03_roundtrip_binary() -> Result<()> {
Ok(())
}

#[cfg(feature="std")]
#[cfg(feature = "std")]
#[test]
fn message_v10_roundtrip_structured() -> Result<()> {
assert_eq!(
Expand All @@ -45,7 +45,7 @@ fn message_v10_roundtrip_structured() -> Result<()> {
Ok(())
}

#[cfg(feature="std")]
#[cfg(feature = "std")]
#[test]
fn message_v10_roundtrip_binary() -> Result<()> {
//TODO this code smells because we're missing a proper way in the public APIs
Expand Down
4 changes: 2 additions & 2 deletions tests/serde_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod test_data;
use test_data::*;

/// This test is a parametrized test that uses data from tests/test_data
#[cfg(feature="std")]
#[cfg(feature = "std")]
#[rstest(
in_event,
out_json,
Expand Down Expand Up @@ -54,7 +54,7 @@ fn serialize_should_succeed(in_event: Event, out_json: Value) {
}

/// This test is a parametrized test that uses data from tests/test_data
#[cfg(feature="std")]
#[cfg(feature = "std")]
#[rstest(
in_json,
out_event,
Expand Down
16 changes: 8 additions & 8 deletions tests/test_data/v10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ use super::*;
use cloudevents::{Event, EventBuilder, EventBuilderV10};
use serde_json::{json, Value};

#[cfg(feature="std")]
use cloudevents::event::UrlExtend;
#[cfg(feature = "std")]
use url::Url;
#[cfg(not(feature="std"))]
#[cfg(not(feature = "std"))]
use String as Url;
use cloudevents::event::UrlExtend;

#[cfg(feature="std")]
#[cfg(feature = "std")]
pub fn minimal() -> Event {
EventBuilderV10::new()
.id(id())
Expand All @@ -27,7 +27,7 @@ pub fn minimal_json() -> Value {
})
}

#[cfg(feature="std")]
#[cfg(feature = "std")]
pub fn full_no_data() -> Event {
let (string_ext_name, string_ext_value) = string_extension();
let (bool_ext_name, bool_ext_value) = bool_extension();
Expand Down Expand Up @@ -64,7 +64,7 @@ pub fn full_no_data_json() -> Value {
})
}

#[cfg(feature="std")]
#[cfg(feature = "std")]
pub fn full_json_data() -> Event {
let (string_ext_name, string_ext_value) = string_extension();
let (bool_ext_name, bool_ext_value) = bool_extension();
Expand Down Expand Up @@ -130,7 +130,7 @@ pub fn full_json_base64_data_json() -> Value {
})
}

#[cfg(feature="std")]
#[cfg(feature = "std")]
pub fn full_xml_string_data() -> Event {
let (string_ext_name, string_ext_value) = string_extension();
let (bool_ext_name, bool_ext_value) = bool_extension();
Expand All @@ -150,7 +150,7 @@ pub fn full_xml_string_data() -> Event {
.unwrap()
}

#[cfg(feature="std")]
#[cfg(feature = "std")]
pub fn full_xml_binary_data() -> Event {
let (string_ext_name, string_ext_value) = string_extension();
let (bool_ext_name, bool_ext_value) = bool_extension();
Expand Down

0 comments on commit 40d8f4f

Please sign in to comment.