mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 03:16: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);
|
||||
|
||||
// Wait for SMTP configuration
|
||||
smtp_config_task.await.unwrap()?;
|
||||
smtp_config_task.await??;
|
||||
|
||||
progress!(ctx, 900);
|
||||
|
||||
|
||||
@@ -679,8 +679,9 @@ impl MimeMessage {
|
||||
fn parse_system_message_headers(&mut self, context: &Context) {
|
||||
if self.get_header(HeaderDef::AutocryptSetupMessage).is_some() && !self.incoming {
|
||||
self.parts.retain(|part| {
|
||||
part.mimetype.is_none()
|
||||
|| part.mimetype.as_ref().unwrap().as_ref() == MIME_AC_SETUP_FILE
|
||||
part.mimetype
|
||||
.as_ref()
|
||||
.is_none_or(|mimetype| mimetype.as_ref() == MIME_AC_SETUP_FILE)
|
||||
});
|
||||
|
||||
if self.parts.len() == 1 {
|
||||
|
||||
@@ -145,14 +145,14 @@ impl SchedulerState {
|
||||
InnerSchedulerState::Started(_) => {
|
||||
let new_state = InnerSchedulerState::Paused {
|
||||
started: true,
|
||||
pause_guards_count: NonZeroUsize::new(1).unwrap(),
|
||||
pause_guards_count: NonZeroUsize::MIN,
|
||||
};
|
||||
Self::do_stop(&mut inner, context, new_state).await;
|
||||
}
|
||||
InnerSchedulerState::Stopped => {
|
||||
*inner = InnerSchedulerState::Paused {
|
||||
started: false,
|
||||
pause_guards_count: NonZeroUsize::new(1).unwrap(),
|
||||
pause_guards_count: NonZeroUsize::MIN,
|
||||
};
|
||||
}
|
||||
InnerSchedulerState::Paused {
|
||||
@@ -183,7 +183,7 @@ impl SchedulerState {
|
||||
ref started,
|
||||
ref mut pause_guards_count,
|
||||
} => {
|
||||
if *pause_guards_count == NonZeroUsize::new(1).unwrap() {
|
||||
if *pause_guards_count == NonZeroUsize::MIN {
|
||||
match *started {
|
||||
true => SchedulerState::do_start(&mut inner, &context).await,
|
||||
false => *inner = InnerSchedulerState::Stopped,
|
||||
|
||||
Reference in New Issue
Block a user