Bunch of feedback: renames, simple functions, no cow

This commit is contained in:
Floris Bruynooghe
2021-02-11 22:24:56 +01:00
parent 29f184b4c4
commit 46a3226e43
22 changed files with 1216 additions and 1814 deletions

View File

@@ -19,7 +19,7 @@ use crate::message::Message;
use crate::oauth2::dc_get_oauth2_addr;
use crate::provider::{Protocol, Socket, UsernamePattern};
use crate::smtp::Smtp;
use crate::stock::{ConfigurationFailed, ErrorNoNetwork};
use crate::stock_str;
use crate::{chat, e2ee, provider};
use crate::{config::Config, dc_tools::time};
use crate::{
@@ -127,14 +127,13 @@ impl Context {
self,
0,
Some(
ConfigurationFailed::stock_str(
stock_str::configuration_failed(
self,
// We are using Anyhow's .context() and to show the
// inner error, too, we need the {:#}:
format!("{:#}", err),
)
.await
.to_string()
)
);
Err(err)
@@ -591,7 +590,7 @@ async fn nicer_configuration_error(context: &Context, errors: Vec<ConfigurationE
.iter()
.all(|e| e.msg.to_lowercase().contains("could not resolve"))
{
return ErrorNoNetwork::stock_str(context).await.to_string();
return stock_str::error_no_network(context).await;
}
if errors.iter().all(|e| e.msg == first_err.msg) {