@@ -394,7 +394,7 @@ fn normalize_security_report(
394
394
return ;
395
395
}
396
396
397
- event. logger . get_or_insert_with ( || "csp" . to_string ( ) ) ;
397
+ event. logger . get_or_insert_with ( || "csp" . to_owned ( ) ) ;
398
398
399
399
if let Some ( client_ip) = client_ip {
400
400
let user = event. user . value_mut ( ) . get_or_insert_with ( User :: default) ;
@@ -582,7 +582,7 @@ fn normalize_breadcrumbs(event: &mut Event) {
582
582
} ;
583
583
584
584
if breadcrumb. ty . value ( ) . is_empty ( ) {
585
- breadcrumb. ty . set_value ( Some ( "default" . to_string ( ) ) ) ;
585
+ breadcrumb. ty . set_value ( Some ( "default" . to_owned ( ) ) ) ;
586
586
}
587
587
if breadcrumb. level . value ( ) . is_none ( ) {
588
588
breadcrumb. level . set_value ( Some ( Level :: Info ) ) ;
@@ -683,13 +683,13 @@ fn normalize_event_tags(event: &mut Event) {
683
683
684
684
let server_name = std:: mem:: take ( & mut event. server_name ) ;
685
685
if server_name. value ( ) . is_some ( ) {
686
- let tag_name = "server_name" . to_string ( ) ;
686
+ let tag_name = "server_name" . to_owned ( ) ;
687
687
tags. insert ( tag_name, server_name) ;
688
688
}
689
689
690
690
let site = std:: mem:: take ( & mut event. site ) ;
691
691
if site. value ( ) . is_some ( ) {
692
- let tag_name = "site" . to_string ( ) ;
692
+ let tag_name = "site" . to_owned ( ) ;
693
693
tags. insert ( tag_name, site) ;
694
694
}
695
695
}
@@ -1005,24 +1005,24 @@ fn normalize_trace_context_tags(event: &mut Event) {
1005
1005
if let Some ( data) = trace_context. data . value ( ) {
1006
1006
if let Some ( lcp_element) = data. lcp_element . value ( ) {
1007
1007
if !tags. contains ( "lcp.element" ) {
1008
- let tag_name = "lcp.element" . to_string ( ) ;
1008
+ let tag_name = "lcp.element" . to_owned ( ) ;
1009
1009
tags. insert ( tag_name, Annotated :: new ( lcp_element. clone ( ) ) ) ;
1010
1010
}
1011
1011
}
1012
1012
if let Some ( lcp_size) = data. lcp_size . value ( ) {
1013
1013
if !tags. contains ( "lcp.size" ) {
1014
- let tag_name = "lcp.size" . to_string ( ) ;
1014
+ let tag_name = "lcp.size" . to_owned ( ) ;
1015
1015
tags. insert ( tag_name, Annotated :: new ( lcp_size. to_string ( ) ) ) ;
1016
1016
}
1017
1017
}
1018
1018
if let Some ( lcp_id) = data. lcp_id . value ( ) {
1019
- let tag_name = "lcp.id" . to_string ( ) ;
1019
+ let tag_name = "lcp.id" . to_owned ( ) ;
1020
1020
if !tags. contains ( "lcp.id" ) {
1021
1021
tags. insert ( tag_name, Annotated :: new ( lcp_id. clone ( ) ) ) ;
1022
1022
}
1023
1023
}
1024
1024
if let Some ( lcp_url) = data. lcp_url . value ( ) {
1025
- let tag_name = "lcp.url" . to_string ( ) ;
1025
+ let tag_name = "lcp.url" . to_owned ( ) ;
1026
1026
if !tags. contains ( "lcp.url" ) {
1027
1027
tags. insert ( tag_name, Annotated :: new ( lcp_url. clone ( ) ) ) ;
1028
1028
}
@@ -1134,7 +1134,7 @@ fn normalize_default_attributes(event: &mut Event, meta: &mut Meta, config: &Nor
1134
1134
// Default required attributes, even if they have errors
1135
1135
event. errors . get_or_insert_with ( Vec :: new) ;
1136
1136
event. id . get_or_insert_with ( EventId :: new) ;
1137
- event. platform . get_or_insert_with ( || "other" . to_string ( ) ) ;
1137
+ event. platform . get_or_insert_with ( || "other" . to_owned ( ) ) ;
1138
1138
event. logger . get_or_insert_with ( String :: new) ;
1139
1139
event. extra . get_or_insert_with ( Object :: new) ;
1140
1140
event. level . get_or_insert_with ( || match event_type {
@@ -1504,10 +1504,10 @@ fn get_metric_measurement_unit(measurement_name: &str) -> Option<MetricUnit> {
1504
1504
/// The snake_case is the key expected by the Sentry UI to aggregate and display in graphs.
1505
1505
fn normalize_app_start_measurements ( measurements : & mut Measurements ) {
1506
1506
if let Some ( app_start_cold_value) = measurements. remove ( "app.start.cold" ) {
1507
- measurements. insert ( "app_start_cold" . to_string ( ) , app_start_cold_value) ;
1507
+ measurements. insert ( "app_start_cold" . to_owned ( ) , app_start_cold_value) ;
1508
1508
}
1509
1509
if let Some ( app_start_warm_value) = measurements. remove ( "app.start.warm" ) {
1510
- measurements. insert ( "app_start_warm" . to_string ( ) , app_start_warm_value) ;
1510
+ measurements. insert ( "app_start_warm" . to_owned ( ) , app_start_warm_value) ;
1511
1511
}
1512
1512
}
1513
1513
@@ -1585,16 +1585,16 @@ mod tests {
1585
1585
1586
1586
#[ test]
1587
1587
fn test_normalize_dist_empty ( ) {
1588
- let mut dist = Annotated :: new ( "" . to_string ( ) ) ;
1588
+ let mut dist = Annotated :: new ( "" . to_owned ( ) ) ;
1589
1589
normalize_dist ( & mut dist) ;
1590
1590
assert_eq ! ( dist. value( ) , None ) ;
1591
1591
}
1592
1592
1593
1593
#[ test]
1594
1594
fn test_normalize_dist_trim ( ) {
1595
- let mut dist = Annotated :: new ( " foo " . to_string ( ) ) ;
1595
+ let mut dist = Annotated :: new ( " foo " . to_owned ( ) ) ;
1596
1596
normalize_dist ( & mut dist) ;
1597
- assert_eq ! ( dist. value( ) , Some ( & "foo" . to_string ( ) ) ) ;
1597
+ assert_eq ! ( dist. value( ) , Some ( & "foo" . to_owned ( ) ) ) ;
1598
1598
}
1599
1599
1600
1600
#[ test]
@@ -1842,7 +1842,7 @@ mod tests {
1842
1842
csp : Annotated :: from ( Csp :: default ( ) ) ,
1843
1843
..Default :: default ( )
1844
1844
} ;
1845
- let ipaddr = IpAddr ( "213.164.1.114" . to_string ( ) ) ;
1845
+ let ipaddr = IpAddr ( "213.164.1.114" . to_owned ( ) ) ;
1846
1846
1847
1847
let client_ip = Some ( & ipaddr) ;
1848
1848
@@ -1919,8 +1919,8 @@ mod tests {
1919
1919
contexts : {
1920
1920
let mut contexts = Contexts :: new ( ) ;
1921
1921
contexts. add ( DeviceContext {
1922
- family : "iPhone" . to_string ( ) . into ( ) ,
1923
- model : "iPhone8,4" . to_string ( ) . into ( ) ,
1922
+ family : "iPhone" . to_owned ( ) . into ( ) ,
1923
+ model : "iPhone8,4" . to_owned ( ) . into ( ) ,
1924
1924
..Default :: default ( )
1925
1925
} ) ;
1926
1926
Annotated :: new ( contexts)
@@ -1948,8 +1948,8 @@ mod tests {
1948
1948
contexts : {
1949
1949
let mut contexts = Contexts :: new ( ) ;
1950
1950
contexts. add ( DeviceContext {
1951
- family : "iPhone" . to_string ( ) . into ( ) ,
1952
- model : "iPhone12,8" . to_string ( ) . into ( ) ,
1951
+ family : "iPhone" . to_owned ( ) . into ( ) ,
1952
+ model : "iPhone12,8" . to_owned ( ) . into ( ) ,
1953
1953
..Default :: default ( )
1954
1954
} ) ;
1955
1955
Annotated :: new ( contexts)
@@ -1977,7 +1977,7 @@ mod tests {
1977
1977
contexts : {
1978
1978
let mut contexts = Contexts :: new ( ) ;
1979
1979
contexts. add ( DeviceContext {
1980
- family : "android" . to_string ( ) . into ( ) ,
1980
+ family : "android" . to_owned ( ) . into ( ) ,
1981
1981
processor_frequency : 1000 . into ( ) ,
1982
1982
processor_count : 6 . into ( ) ,
1983
1983
memory_size : ( 2 * 1024 * 1024 * 1024 ) . into ( ) ,
@@ -2008,7 +2008,7 @@ mod tests {
2008
2008
contexts : {
2009
2009
let mut contexts = Contexts :: new ( ) ;
2010
2010
contexts. add ( DeviceContext {
2011
- family : "android" . to_string ( ) . into ( ) ,
2011
+ family : "android" . to_owned ( ) . into ( ) ,
2012
2012
processor_frequency : 2000 . into ( ) ,
2013
2013
processor_count : 8 . into ( ) ,
2014
2014
memory_size : ( 6 * 1024 * 1024 * 1024 ) . into ( ) ,
@@ -2039,7 +2039,7 @@ mod tests {
2039
2039
contexts : {
2040
2040
let mut contexts = Contexts :: new ( ) ;
2041
2041
contexts. add ( DeviceContext {
2042
- family : "android" . to_string ( ) . into ( ) ,
2042
+ family : "android" . to_owned ( ) . into ( ) ,
2043
2043
processor_frequency : 2500 . into ( ) ,
2044
2044
processor_count : 8 . into ( ) ,
2045
2045
memory_size : ( 6 * 1024 * 1024 * 1024 ) . into ( ) ,
@@ -2416,8 +2416,8 @@ mod tests {
2416
2416
contexts : {
2417
2417
let mut contexts = Contexts :: new ( ) ;
2418
2418
contexts. add ( DeviceContext {
2419
- family : "iPhone" . to_string ( ) . into ( ) ,
2420
- model : "iPhone15,3" . to_string ( ) . into ( ) ,
2419
+ family : "iPhone" . to_owned ( ) . into ( ) ,
2420
+ model : "iPhone15,3" . to_owned ( ) . into ( ) ,
2421
2421
..Default :: default ( )
2422
2422
} ) ;
2423
2423
Annotated :: new ( contexts)
@@ -4236,20 +4236,20 @@ mod tests {
4236
4236
assert_eq ! ( user. data, {
4237
4237
let mut map = Object :: new( ) ;
4238
4238
map. insert(
4239
- "other" . to_string ( ) ,
4239
+ "other" . to_owned ( ) ,
4240
4240
Annotated :: new( Value :: String ( "value" . to_owned( ) ) ) ,
4241
4241
) ;
4242
4242
Annotated :: new( map)
4243
4243
} ) ;
4244
4244
assert_eq ! ( user. other, Object :: new( ) ) ;
4245
- assert_eq ! ( user. username, Annotated :: new( "john" . to_string ( ) . into( ) ) ) ;
4246
- assert_eq ! ( user. sentry_user, Annotated :: new( "id:123456" . to_string ( ) ) ) ;
4245
+ assert_eq ! ( user. username, Annotated :: new( "john" . to_owned ( ) . into( ) ) ) ;
4246
+ assert_eq ! ( user. sentry_user, Annotated :: new( "id:123456" . to_owned ( ) ) ) ;
4247
4247
}
4248
4248
4249
4249
#[ test]
4250
4250
fn test_handle_types_in_spaced_exception_values ( ) {
4251
4251
let mut exception = Annotated :: new ( Exception {
4252
- value : Annotated :: new ( "ValueError: unauthorized" . to_string ( ) . into ( ) ) ,
4252
+ value : Annotated :: new ( "ValueError: unauthorized" . to_owned ( ) . into ( ) ) ,
4253
4253
..Exception :: default ( )
4254
4254
} ) ;
4255
4255
normalize_exception ( & mut exception) ;
@@ -4262,7 +4262,7 @@ mod tests {
4262
4262
#[ test]
4263
4263
fn test_handle_types_in_non_spaced_excepton_values ( ) {
4264
4264
let mut exception = Annotated :: new ( Exception {
4265
- value : Annotated :: new ( "ValueError:unauthorized" . to_string ( ) . into ( ) ) ,
4265
+ value : Annotated :: new ( "ValueError:unauthorized" . to_owned ( ) . into ( ) ) ,
4266
4266
..Exception :: default ( )
4267
4267
} ) ;
4268
4268
normalize_exception ( & mut exception) ;
@@ -4275,8 +4275,8 @@ mod tests {
4275
4275
#[ test]
4276
4276
fn test_rejects_empty_exception_fields ( ) {
4277
4277
let mut exception = Annotated :: new ( Exception {
4278
- value : Annotated :: new ( "" . to_string ( ) . into ( ) ) ,
4279
- ty : Annotated :: new ( "" . to_string ( ) ) ,
4278
+ value : Annotated :: new ( "" . to_owned ( ) . into ( ) ) ,
4279
+ ty : Annotated :: new ( "" . to_owned ( ) ) ,
4280
4280
..Default :: default ( )
4281
4281
} ) ;
4282
4282
0 commit comments