Skip to content

Commit a63f7d0

Browse files
committed
fixed cargo fmt check and clippy warnings
Signed-off-by: minghuaw <[email protected]>
1 parent 5e90cc6 commit a63f7d0

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/binding/fe2o3_amqp/mod.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@ impl EventMessage {
157157

158158
impl From<EventMessage> for AmqpMessage {
159159
fn from(event: EventMessage) -> Self {
160-
let mut properties = Properties::default();
161-
properties.content_type = event.content_type;
160+
let properties = Properties {
161+
content_type: event.content_type,
162+
..Default::default()
163+
};
162164
Message {
163165
header: None,
164166
delivery_annotations: None,
@@ -173,7 +175,7 @@ impl From<EventMessage> for AmqpMessage {
173175

174176
impl From<AmqpMessage> for EventMessage {
175177
fn from(message: AmqpMessage) -> Self {
176-
let content_type = message.properties.map(|p| p.content_type).flatten();
178+
let content_type = message.properties.and_then(|p| p.content_type);
177179
Self {
178180
content_type,
179181
application_properties: message.application_properties,
@@ -223,9 +225,9 @@ impl<'a> From<AttributeValue<'a>> for Value {
223225
impl From<MessageAttributeValue> for SimpleValue {
224226
fn from(value: MessageAttributeValue) -> Self {
225227
match value {
226-
MessageAttributeValue::String(s) => SimpleValue::String(String::from(s)),
228+
MessageAttributeValue::String(s) => SimpleValue::String(s),
227229
MessageAttributeValue::Uri(uri) => SimpleValue::String(String::from(uri.as_str())),
228-
MessageAttributeValue::UriRef(uri) => SimpleValue::String(uri.clone()),
230+
MessageAttributeValue::UriRef(uri) => SimpleValue::String(uri),
229231
MessageAttributeValue::Boolean(val) => SimpleValue::Bool(val),
230232
MessageAttributeValue::Integer(val) => SimpleValue::Long(val),
231233
MessageAttributeValue::DateTime(datetime) => {
@@ -241,9 +243,9 @@ impl From<MessageAttributeValue> for SimpleValue {
241243
impl From<MessageAttributeValue> for Value {
242244
fn from(value: MessageAttributeValue) -> Self {
243245
match value {
244-
MessageAttributeValue::String(s) => Value::String(String::from(s)),
246+
MessageAttributeValue::String(s) => Value::String(s),
245247
MessageAttributeValue::Uri(uri) => Value::String(String::from(uri.as_str())),
246-
MessageAttributeValue::UriRef(uri) => Value::String(uri.clone()),
248+
MessageAttributeValue::UriRef(uri) => Value::String(uri),
247249
MessageAttributeValue::Boolean(val) => Value::Bool(val),
248250
MessageAttributeValue::Integer(val) => Value::Long(val),
249251
MessageAttributeValue::DateTime(datetime) => {

0 commit comments

Comments
 (0)