@@ -26,8 +26,8 @@ impl ToJson for ErrorResponse {
26
26
/// Serialize an ErrorResponse object into a proper JSON structure.
27
27
fn to_json ( & self ) -> Json {
28
28
let mut d = BTreeMap :: new ( ) ;
29
- d. insert ( "status" . to_string ( ) , "error" . to_json ( ) ) ;
30
- d. insert ( "reason" . to_string ( ) , self . reason . to_json ( ) ) ;
29
+ d. insert ( "status" . into ( ) , "error" . to_json ( ) ) ;
30
+ d. insert ( "reason" . into ( ) , self . reason . to_json ( ) ) ;
31
31
Json :: Object ( d)
32
32
}
33
33
}
@@ -140,7 +140,7 @@ impl UpdateHandler {
140
140
let sensor_specs = self . sensor_specs . lock ( ) . unwrap ( ) ;
141
141
let sensor_spec = try!( sensor_specs. iter ( )
142
142
. find ( |& spec| spec. data_key == sensor)
143
- . ok_or ( sensors:: SensorError :: UnknownSensor ( sensor. to_string ( ) ) ) ) ;
143
+ . ok_or ( sensors:: SensorError :: UnknownSensor ( sensor. into ( ) ) ) ) ;
144
144
145
145
// Store data
146
146
sensor_spec. set_sensor_value ( & self . redis_connection_info , value)
@@ -157,7 +157,7 @@ impl UpdateHandler {
157
157
158
158
/// Build an error response with the specified `error_code` and the specified `reason` text.
159
159
fn err_response ( & self , error_code : status:: Status , reason : & str ) -> Response {
160
- let error = ErrorResponse { reason : reason. to_string ( ) } ;
160
+ let error = ErrorResponse { reason : reason. into ( ) } ;
161
161
Response :: with ( ( error_code, error. to_json ( ) . to_string ( ) ) )
162
162
// Set headers
163
163
. set ( Header ( headers:: ContentType ( "application/json; charset=utf-8" . parse ( ) . unwrap ( ) ) ) )
0 commit comments