Skip to content

Commit 1a9d0d4

Browse files
Merge pull request #134 from jcrossley3/clippy
Fix clippy warnings
2 parents bf21c52 + c1715d7 commit 1a9d0d4

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

src/event/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ impl fmt::Display for Event {
120120
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
121121
writeln!(f, "CloudEvent:")?;
122122
self.iter()
123-
.map(|(name, val)| writeln!(f, " {}: '{}'", name, val))
124-
.collect::<fmt::Result>()?;
123+
.try_for_each(|(name, val)| writeln!(f, " {}: '{}'", name, val))?;
125124
match self.data() {
126125
Some(data) => write!(f, " {}", data)?,
127126
None => write!(f, " No data")?,

src/message/types.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ impl fmt::Display for MessageAttributeValue {
5454
}
5555
}
5656

57-
impl Into<MessageAttributeValue> for ExtensionValue {
58-
fn into(self) -> MessageAttributeValue {
59-
match self {
57+
impl From<ExtensionValue> for MessageAttributeValue {
58+
fn from(that: ExtensionValue) -> Self {
59+
match that {
6060
ExtensionValue::String(s) => MessageAttributeValue::String(s),
6161
ExtensionValue::Boolean(b) => MessageAttributeValue::Boolean(b),
6262
ExtensionValue::Integer(i) => MessageAttributeValue::Integer(i),
6363
}
6464
}
6565
}
6666

67-
impl Into<ExtensionValue> for MessageAttributeValue {
68-
fn into(self) -> ExtensionValue {
69-
match self {
67+
impl From<MessageAttributeValue> for ExtensionValue {
68+
fn from(that: MessageAttributeValue) -> Self {
69+
match that {
7070
MessageAttributeValue::Integer(i) => ExtensionValue::Integer(i),
7171
MessageAttributeValue::Boolean(b) => ExtensionValue::Boolean(b),
7272
v => ExtensionValue::String(v.to_string()),

src/warp/server_request.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl BinaryDeserializer for RequestDeserializer {
6363
)?
6464
}
6565

66-
if self.body.len() != 0 {
66+
if !self.body.is_empty() {
6767
visitor.end_with_data(self.body.to_vec())
6868
} else {
6969
visitor.end()

src/warp/server_response.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,15 @@ impl BinarySerializer<Response> for ResponseSerializer {
8484

8585
impl StructuredSerializer<Response> for ResponseSerializer {
8686
fn set_structured_event(self, bytes: Vec<u8>) -> Result<Response> {
87-
Ok(self
88-
.builder
87+
self.builder
8988
.header(
9089
http::header::CONTENT_TYPE,
9190
headers::CLOUDEVENTS_JSON_HEADER.clone(),
9291
)
9392
.body(Body::from(bytes))
9493
.map_err(|e| crate::message::Error::Other {
9594
source: Box::new(e),
96-
})?)
95+
})
9796
}
9897
}
9998

0 commit comments

Comments
 (0)