File tree Expand file tree Collapse file tree 5 files changed +21
-28
lines changed Expand file tree Collapse file tree 5 files changed +21
-28
lines changed Original file line number Diff line number Diff line change @@ -67,19 +67,15 @@ fn parse_server<B: BufRead>(
67
67
68
68
let typ = server_event
69
69
. attributes ( )
70
- . find ( |attr| {
71
- attr. as_ref ( )
72
- . map ( |a| {
73
- String :: from_utf8_lossy ( a. key . as_ref ( ) )
74
- . trim ( )
75
- . to_lowercase ( )
76
- == "type"
77
- } )
78
- . unwrap_or_default ( )
70
+ . find_map ( |attr| {
71
+ attr. ok ( ) . filter ( |a| {
72
+ String :: from_utf8_lossy ( a. key . as_ref ( ) )
73
+ . trim ( )
74
+ . eq_ignore_ascii_case ( "type" )
75
+ } )
79
76
} )
80
77
. map ( |typ| {
81
- typ. unwrap ( )
82
- . decode_and_unescape_value ( reader. decoder ( ) )
78
+ typ. decode_and_unescape_value ( reader. decoder ( ) )
83
79
. unwrap_or_default ( )
84
80
. to_lowercase ( )
85
81
} )
Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ pub struct InnerContext {
276
276
/// The text of the last error logged and emitted as an event.
277
277
/// If the ui wants to display an error after a failure,
278
278
/// `last_error` should be used to avoid races with the event thread.
279
- pub ( crate ) last_error : std :: sync :: RwLock < String > ,
279
+ pub ( crate ) last_error : parking_lot :: RwLock < String > ,
280
280
281
281
/// If debug logging is enabled, this contains all necessary information
282
282
///
@@ -446,7 +446,7 @@ impl Context {
446
446
metadata : RwLock :: new ( None ) ,
447
447
creation_time : tools:: Time :: now ( ) ,
448
448
last_full_folder_scan : Mutex :: new ( None ) ,
449
- last_error : std :: sync :: RwLock :: new ( "" . to_string ( ) ) ,
449
+ last_error : parking_lot :: RwLock :: new ( "" . to_string ( ) ) ,
450
450
debug_logging : std:: sync:: RwLock :: new ( None ) ,
451
451
push_subscriber,
452
452
push_subscribed : AtomicBool :: new ( false ) ,
Original file line number Diff line number Diff line change @@ -244,18 +244,14 @@ impl Kml {
244
244
self . tag = KmlTag :: PlacemarkPoint ;
245
245
} else if tag == "coordinates" && self . tag == KmlTag :: PlacemarkPoint {
246
246
self . tag = KmlTag :: PlacemarkPointCoordinates ;
247
- if let Some ( acc) = event. attributes ( ) . find ( |attr| {
248
- attr. as_ref ( )
249
- . map ( |a| {
250
- String :: from_utf8_lossy ( a. key . as_ref ( ) )
251
- . trim ( )
252
- . to_lowercase ( )
253
- == "accuracy"
254
- } )
255
- . unwrap_or_default ( )
247
+ if let Some ( acc) = event. attributes ( ) . find_map ( |attr| {
248
+ attr. ok ( ) . filter ( |a| {
249
+ String :: from_utf8_lossy ( a. key . as_ref ( ) )
250
+ . trim ( )
251
+ . eq_ignore_ascii_case ( "accuracy" )
252
+ } )
256
253
} ) {
257
254
let v = acc
258
- . unwrap ( )
259
255
. decode_and_unescape_value ( reader. decoder ( ) )
260
256
. unwrap_or_default ( ) ;
261
257
Original file line number Diff line number Diff line change @@ -50,13 +50,13 @@ impl Context {
50
50
/// Set last error string.
51
51
/// Implemented as blocking as used from macros in different, not always async blocks.
52
52
pub fn set_last_error ( & self , error : & str ) {
53
- let mut last_error = self . last_error . write ( ) . unwrap ( ) ;
53
+ let mut last_error = self . last_error . write ( ) ;
54
54
* last_error = error. to_string ( ) ;
55
55
}
56
56
57
57
/// Get last error string.
58
58
pub fn get_last_error ( & self ) -> String {
59
- let last_error = & * self . last_error . read ( ) . unwrap ( ) ;
59
+ let last_error = & * self . last_error . read ( ) ;
60
60
last_error. clone ( )
61
61
}
62
62
}
Original file line number Diff line number Diff line change @@ -1667,10 +1667,11 @@ impl MimeMessage {
1667
1667
{
1668
1668
let mut to_list =
1669
1669
get_all_addresses_from_header ( & report. headers , "x-failed-recipients" ) ;
1670
- let to = if to_list. len ( ) == 1 {
1671
- Some ( to_list. pop ( ) . unwrap ( ) )
1670
+ let to = if to_list. len ( ) != 1 {
1671
+ // We do not know which recipient failed
1672
+ None
1672
1673
} else {
1673
- None // We do not know which recipient failed
1674
+ to_list . pop ( )
1674
1675
} ;
1675
1676
1676
1677
return Ok ( Some ( DeliveryReport {
You can’t perform that action at this time.
0 commit comments