mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
refactor: remove some easy to remove unwrap() calls
This commit is contained in:
@@ -525,7 +525,7 @@ async fn configure(ctx: &Context, param: &EnteredLoginParam) -> Result<Option<&'
|
|||||||
progress!(ctx, 850);
|
progress!(ctx, 850);
|
||||||
|
|
||||||
// Wait for SMTP configuration
|
// Wait for SMTP configuration
|
||||||
smtp_config_task.await.unwrap()?;
|
smtp_config_task.await??;
|
||||||
|
|
||||||
progress!(ctx, 900);
|
progress!(ctx, 900);
|
||||||
|
|
||||||
|
|||||||
@@ -679,8 +679,9 @@ impl MimeMessage {
|
|||||||
fn parse_system_message_headers(&mut self, context: &Context) {
|
fn parse_system_message_headers(&mut self, context: &Context) {
|
||||||
if self.get_header(HeaderDef::AutocryptSetupMessage).is_some() && !self.incoming {
|
if self.get_header(HeaderDef::AutocryptSetupMessage).is_some() && !self.incoming {
|
||||||
self.parts.retain(|part| {
|
self.parts.retain(|part| {
|
||||||
part.mimetype.is_none()
|
part.mimetype
|
||||||
|| part.mimetype.as_ref().unwrap().as_ref() == MIME_AC_SETUP_FILE
|
.as_ref()
|
||||||
|
.is_none_or(|mimetype| mimetype.as_ref() == MIME_AC_SETUP_FILE)
|
||||||
});
|
});
|
||||||
|
|
||||||
if self.parts.len() == 1 {
|
if self.parts.len() == 1 {
|
||||||
|
|||||||
@@ -145,14 +145,14 @@ impl SchedulerState {
|
|||||||
InnerSchedulerState::Started(_) => {
|
InnerSchedulerState::Started(_) => {
|
||||||
let new_state = InnerSchedulerState::Paused {
|
let new_state = InnerSchedulerState::Paused {
|
||||||
started: true,
|
started: true,
|
||||||
pause_guards_count: NonZeroUsize::new(1).unwrap(),
|
pause_guards_count: NonZeroUsize::MIN,
|
||||||
};
|
};
|
||||||
Self::do_stop(&mut inner, context, new_state).await;
|
Self::do_stop(&mut inner, context, new_state).await;
|
||||||
}
|
}
|
||||||
InnerSchedulerState::Stopped => {
|
InnerSchedulerState::Stopped => {
|
||||||
*inner = InnerSchedulerState::Paused {
|
*inner = InnerSchedulerState::Paused {
|
||||||
started: false,
|
started: false,
|
||||||
pause_guards_count: NonZeroUsize::new(1).unwrap(),
|
pause_guards_count: NonZeroUsize::MIN,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
InnerSchedulerState::Paused {
|
InnerSchedulerState::Paused {
|
||||||
@@ -183,7 +183,7 @@ impl SchedulerState {
|
|||||||
ref started,
|
ref started,
|
||||||
ref mut pause_guards_count,
|
ref mut pause_guards_count,
|
||||||
} => {
|
} => {
|
||||||
if *pause_guards_count == NonZeroUsize::new(1).unwrap() {
|
if *pause_guards_count == NonZeroUsize::MIN {
|
||||||
match *started {
|
match *started {
|
||||||
true => SchedulerState::do_start(&mut inner, &context).await,
|
true => SchedulerState::do_start(&mut inner, &context).await,
|
||||||
false => *inner = InnerSchedulerState::Stopped,
|
false => *inner = InnerSchedulerState::Stopped,
|
||||||
|
|||||||
Reference in New Issue
Block a user