@@ -94,10 +94,10 @@ fn normalize_runtime_context(runtime: &mut RuntimeContext) {
94
94
if runtime. name . value ( ) . is_empty ( ) && runtime. version . value ( ) . is_empty ( ) {
95
95
if let Some ( raw_description) = runtime. raw_description . as_str ( ) {
96
96
if let Some ( captures) = RUNTIME_DOTNET_REGEX . captures ( raw_description) {
97
- runtime. name = captures. name ( "name" ) . map ( |m| m. as_str ( ) . to_string ( ) ) . into ( ) ;
97
+ runtime. name = captures. name ( "name" ) . map ( |m| m. as_str ( ) . to_owned ( ) ) . into ( ) ;
98
98
runtime. version = captures
99
99
. name ( "version" )
100
- . map ( |m| m. as_str ( ) . to_string ( ) )
100
+ . map ( |m| m. as_str ( ) . to_owned ( ) )
101
101
. into ( ) ;
102
102
}
103
103
}
@@ -200,62 +200,62 @@ fn normalize_os_context(os: &mut OsContext) {
200
200
if let Some ( raw_description) = os. raw_description . as_str ( ) {
201
201
if let Some ( ( version, build_number) ) = get_windows_version ( raw_description) {
202
202
os. name = "Windows" . to_owned ( ) . into ( ) ;
203
- os. version = version. to_string ( ) . into ( ) ;
203
+ os. version = version. to_owned ( ) . into ( ) ;
204
204
if os. build . is_empty ( ) {
205
205
// Keep raw version as build
206
- os. build . set_value ( Some ( build_number. to_string ( ) . into ( ) ) ) ;
206
+ os. build . set_value ( Some ( build_number. to_owned ( ) . into ( ) ) ) ;
207
207
}
208
208
} else if let Some ( captures) = OS_MACOS_REGEX . captures ( raw_description) {
209
209
os. name = "macOS" . to_owned ( ) . into ( ) ;
210
210
os. version = captures
211
211
. name ( "version" )
212
- . map ( |m| m. as_str ( ) . to_string ( ) )
212
+ . map ( |m| m. as_str ( ) . to_owned ( ) )
213
213
. into ( ) ;
214
214
os. build = captures
215
215
. name ( "build" )
216
- . map ( |m| m. as_str ( ) . to_string ( ) . into ( ) )
216
+ . map ( |m| m. as_str ( ) . to_owned ( ) . into ( ) )
217
217
. into ( ) ;
218
218
} else if let Some ( captures) = OS_IOS_REGEX . captures ( raw_description) {
219
219
os. name = "iOS" . to_owned ( ) . into ( ) ;
220
220
os. version = captures
221
221
. name ( "version" )
222
- . map ( |m| m. as_str ( ) . to_string ( ) )
222
+ . map ( |m| m. as_str ( ) . to_owned ( ) )
223
223
. into ( ) ;
224
224
os. build = captures
225
225
. name ( "build" )
226
- . map ( |m| m. as_str ( ) . to_string ( ) . into ( ) )
226
+ . map ( |m| m. as_str ( ) . to_owned ( ) . into ( ) )
227
227
. into ( ) ;
228
228
} else if let Some ( captures) = OS_IPADOS_REGEX . captures ( raw_description) {
229
229
os. name = "iPadOS" . to_owned ( ) . into ( ) ;
230
230
os. version = captures
231
231
. name ( "version" )
232
- . map ( |m| m. as_str ( ) . to_string ( ) )
232
+ . map ( |m| m. as_str ( ) . to_owned ( ) )
233
233
. into ( ) ;
234
234
os. build = captures
235
235
. name ( "build" )
236
- . map ( |m| m. as_str ( ) . to_string ( ) . into ( ) )
236
+ . map ( |m| m. as_str ( ) . to_owned ( ) . into ( ) )
237
237
. into ( ) ;
238
238
} else if let Some ( captures) = OS_LINUX_DISTRO_UNAME_REGEX . captures ( raw_description) {
239
- os. name = captures. name ( "name" ) . map ( |m| m. as_str ( ) . to_string ( ) ) . into ( ) ;
239
+ os. name = captures. name ( "name" ) . map ( |m| m. as_str ( ) . to_owned ( ) ) . into ( ) ;
240
240
os. version = captures
241
241
. name ( "version" )
242
- . map ( |m| m. as_str ( ) . to_string ( ) )
242
+ . map ( |m| m. as_str ( ) . to_owned ( ) )
243
243
. into ( ) ;
244
244
os. kernel_version = captures
245
245
. name ( "kernel_version" )
246
- . map ( |m| m. as_str ( ) . to_string ( ) )
246
+ . map ( |m| m. as_str ( ) . to_owned ( ) )
247
247
. into ( ) ;
248
248
} else if let Some ( captures) = OS_UNAME_REGEX . captures ( raw_description) {
249
- os. name = captures. name ( "name" ) . map ( |m| m. as_str ( ) . to_string ( ) ) . into ( ) ;
249
+ os. name = captures. name ( "name" ) . map ( |m| m. as_str ( ) . to_owned ( ) ) . into ( ) ;
250
250
os. kernel_version = captures
251
251
. name ( "kernel_version" )
252
- . map ( |m| m. as_str ( ) . to_string ( ) )
252
+ . map ( |m| m. as_str ( ) . to_owned ( ) )
253
253
. into ( ) ;
254
254
} else if let Some ( captures) = OS_ANDROID_REGEX . captures ( raw_description) {
255
255
os. name = "Android" . to_owned ( ) . into ( ) ;
256
256
os. version = captures
257
257
. name ( "version" )
258
- . map ( |m| m. as_str ( ) . to_string ( ) )
258
+ . map ( |m| m. as_str ( ) . to_owned ( ) )
259
259
. into ( ) ;
260
260
} else if raw_description == "Nintendo Switch" {
261
261
os. name = "Nintendo OS" . to_owned ( ) . into ( ) ;
@@ -302,13 +302,13 @@ fn normalize_response_data(response: &mut ResponseContext) {
302
302
// Retain meta data on the body (e.g. trimming annotations) but remove anything on the
303
303
// inferred content type.
304
304
response. data . set_value ( Some ( parsed_data) ) ;
305
- response. inferred_content_type = Annotated :: from ( content_type. to_string ( ) ) ;
305
+ response. inferred_content_type = Annotated :: from ( content_type. to_owned ( ) ) ;
306
306
} else {
307
307
response. inferred_content_type = response
308
308
. headers
309
309
. value ( )
310
310
. and_then ( |headers| headers. get_header ( "Content-Type" ) )
311
- . map ( |value| value. split ( ';' ) . next ( ) . unwrap_or ( value) . to_string ( ) )
311
+ . map ( |value| value. split ( ';' ) . next ( ) . unwrap_or ( value) . to_owned ( ) )
312
312
. into ( ) ;
313
313
}
314
314
}
@@ -451,7 +451,7 @@ mod tests {
451
451
// Environment.OSVersion on Windows 7 (CoreCLR 1.0+, .NET Framework 1.1+, Mono 1+)
452
452
let mut os = OsContext {
453
453
raw_description : "Microsoft Windows NT 6.1.7601 Service Pack 1"
454
- . to_string ( )
454
+ . to_owned ( )
455
455
. into ( ) ,
456
456
..OsContext :: default ( )
457
457
} ;
@@ -574,7 +574,7 @@ mod tests {
574
574
// RuntimeInformation.OSDescription on CentOS 7 (CoreCLR 2.0+, Mono 5.4+)
575
575
let mut os = OsContext {
576
576
raw_description : "Linux 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018"
577
- . to_string ( )
577
+ . to_owned ( )
578
578
. into ( ) ,
579
579
..OsContext :: default ( )
580
580
} ;
@@ -590,7 +590,7 @@ mod tests {
590
590
// (CoreCLR 2.0+, Mono 5.4+)
591
591
let mut os = OsContext {
592
592
raw_description : "Linux 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014"
593
- . to_string ( )
593
+ . to_owned ( )
594
594
. into ( ) ,
595
595
..OsContext :: default ( )
596
596
} ;
@@ -716,7 +716,7 @@ mod tests {
716
716
fn test_unity_android_os ( ) {
717
717
let mut os = OsContext {
718
718
raw_description : "Android OS 11 / API-30 (RP1A.201005.001/2107031736)"
719
- . to_string ( )
719
+ . to_owned ( )
720
720
. into ( ) ,
721
721
..OsContext :: default ( )
722
722
} ;
@@ -763,7 +763,7 @@ mod tests {
763
763
fn test_android_4_4_2 ( ) {
764
764
let mut os = OsContext {
765
765
raw_description : "Android OS 4.4.2 / API-19 (KOT49H/A536_S186_150813_ROW)"
766
- . to_string ( )
766
+ . to_owned ( )
767
767
. into ( ) ,
768
768
..OsContext :: default ( )
769
769
} ;
@@ -776,7 +776,7 @@ mod tests {
776
776
#[ test]
777
777
fn test_infer_json ( ) {
778
778
let mut response = ResponseContext {
779
- data : Annotated :: from ( Value :: String ( r#"{"foo":"bar"}"# . to_string ( ) ) ) ,
779
+ data : Annotated :: from ( Value :: String ( r#"{"foo":"bar"}"# . to_owned ( ) ) ) ,
780
780
..ResponseContext :: default ( )
781
781
} ;
782
782
@@ -797,7 +797,7 @@ mod tests {
797
797
#[ test]
798
798
fn test_broken_json_with_fallback ( ) {
799
799
let mut response = ResponseContext {
800
- data : Annotated :: from ( Value :: String ( r#"{"foo":"b"# . to_string ( ) ) ) ,
800
+ data : Annotated :: from ( Value :: String ( r#"{"foo":"b"# . to_owned ( ) ) ) ,
801
801
headers : Annotated :: from ( Headers ( PairList ( vec ! [ Annotated :: new( (
802
802
Annotated :: new( "Content-Type" . to_owned( ) . into( ) ) ,
803
803
Annotated :: new( "text/plain; encoding=utf-8" . to_owned( ) . into( ) ) ,
@@ -813,7 +813,7 @@ mod tests {
813
813
#[ test]
814
814
fn test_broken_json_without_fallback ( ) {
815
815
let mut response = ResponseContext {
816
- data : Annotated :: from ( Value :: String ( r#"{"foo":"b"# . to_string ( ) ) ) ,
816
+ data : Annotated :: from ( Value :: String ( r#"{"foo":"b"# . to_owned ( ) ) ) ,
817
817
..ResponseContext :: default ( )
818
818
} ;
819
819
0 commit comments