Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ impl fmt::Display for Event {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
writeln!(f, "CloudEvent:")?;
self.iter()
.map(|(name, val)| writeln!(f, " {}: '{}'", name, val))
.collect::<fmt::Result>()?;
.try_for_each(|(name, val)| writeln!(f, " {}: '{}'", name, val))?;
match self.data() {
Some(data) => write!(f, " {}", data)?,
None => write!(f, " No data")?,
Expand Down
12 changes: 6 additions & 6 deletions src/message/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ impl fmt::Display for MessageAttributeValue {
}
}

impl Into<MessageAttributeValue> for ExtensionValue {
fn into(self) -> MessageAttributeValue {
match self {
impl From<ExtensionValue> for MessageAttributeValue {
fn from(that: ExtensionValue) -> Self {
match that {
ExtensionValue::String(s) => MessageAttributeValue::String(s),
ExtensionValue::Boolean(b) => MessageAttributeValue::Boolean(b),
ExtensionValue::Integer(i) => MessageAttributeValue::Integer(i),
}
}
}

impl Into<ExtensionValue> for MessageAttributeValue {
fn into(self) -> ExtensionValue {
match self {
impl From<MessageAttributeValue> for ExtensionValue {
fn from(that: MessageAttributeValue) -> Self {
match that {
MessageAttributeValue::Integer(i) => ExtensionValue::Integer(i),
MessageAttributeValue::Boolean(b) => ExtensionValue::Boolean(b),
v => ExtensionValue::String(v.to_string()),
Expand Down
2 changes: 1 addition & 1 deletion src/warp/server_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl BinaryDeserializer for RequestDeserializer {
)?
}

if self.body.len() != 0 {
if !self.body.is_empty() {
visitor.end_with_data(self.body.to_vec())
} else {
visitor.end()
Expand Down
5 changes: 2 additions & 3 deletions src/warp/server_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ impl BinarySerializer<Response> for ResponseSerializer {

impl StructuredSerializer<Response> for ResponseSerializer {
fn set_structured_event(self, bytes: Vec<u8>) -> Result<Response> {
Ok(self
.builder
self.builder
.header(
http::header::CONTENT_TYPE,
headers::CLOUDEVENTS_JSON_HEADER.clone(),
)
.body(Body::from(bytes))
.map_err(|e| crate::message::Error::Other {
source: Box::new(e),
})?)
})
}
}

Expand Down