@@ -157,8 +157,10 @@ impl EventMessage {
157
157
158
158
impl From < EventMessage > for AmqpMessage {
159
159
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
+ } ;
162
164
Message {
163
165
header : None ,
164
166
delivery_annotations : None ,
@@ -173,7 +175,7 @@ impl From<EventMessage> for AmqpMessage {
173
175
174
176
impl From < AmqpMessage > for EventMessage {
175
177
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 ) ;
177
179
Self {
178
180
content_type,
179
181
application_properties : message. application_properties ,
@@ -223,9 +225,9 @@ impl<'a> From<AttributeValue<'a>> for Value {
223
225
impl From < MessageAttributeValue > for SimpleValue {
224
226
fn from ( value : MessageAttributeValue ) -> Self {
225
227
match value {
226
- MessageAttributeValue :: String ( s) => SimpleValue :: String ( String :: from ( s ) ) ,
228
+ MessageAttributeValue :: String ( s) => SimpleValue :: String ( s ) ,
227
229
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) ,
229
231
MessageAttributeValue :: Boolean ( val) => SimpleValue :: Bool ( val) ,
230
232
MessageAttributeValue :: Integer ( val) => SimpleValue :: Long ( val) ,
231
233
MessageAttributeValue :: DateTime ( datetime) => {
@@ -241,9 +243,9 @@ impl From<MessageAttributeValue> for SimpleValue {
241
243
impl From < MessageAttributeValue > for Value {
242
244
fn from ( value : MessageAttributeValue ) -> Self {
243
245
match value {
244
- MessageAttributeValue :: String ( s) => Value :: String ( String :: from ( s ) ) ,
246
+ MessageAttributeValue :: String ( s) => Value :: String ( s ) ,
245
247
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) ,
247
249
MessageAttributeValue :: Boolean ( val) => Value :: Bool ( val) ,
248
250
MessageAttributeValue :: Integer ( val) => Value :: Long ( val) ,
249
251
MessageAttributeValue :: DateTime ( datetime) => {
0 commit comments