diff --git a/db/db-migrations/src/main.rs b/db/db-migrations/src/main.rs index 64957a17..380b3630 100644 --- a/db/db-migrations/src/main.rs +++ b/db/db-migrations/src/main.rs @@ -8,7 +8,6 @@ use std::env; use sqlx::postgres::PgPoolOptions; use sqlx::mysql::MySqlPoolOptions; -#[cfg(not(tarpaulin_include))] #[actix_rt::main] async fn main() { //TODO featuregate sqlite and postgres diff --git a/src/data.rs b/src/data.rs index 23cf1896..d3b683c0 100644 --- a/src/data.rs +++ b/src/data.rs @@ -188,7 +188,6 @@ impl Data { .build() .unwrap() } - #[cfg(not(tarpaulin_include))] /// create new instance of app data pub async fn new(s: &Settings, survey_secrets: SecretsStore) -> Arc { let creds = Self::get_creds(); diff --git a/src/errors.rs b/src/errors.rs index f8fa590e..1f09943e 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -40,7 +40,6 @@ impl std::cmp::PartialEq for SmtpErrorWrapper { } #[derive(Debug, Display, PartialEq, Error)] -#[cfg(not(tarpaulin_include))] pub enum ServiceError { #[display(fmt = "internal server error")] InternalServerError, @@ -114,14 +113,11 @@ pub enum ServiceError { } #[derive(Serialize, Deserialize)] -#[cfg(not(tarpaulin_include))] pub struct ErrorToResponse { pub error: String, } -#[cfg(not(tarpaulin_include))] impl ResponseError for ServiceError { - #[cfg(not(tarpaulin_include))] fn error_response(&self) -> HttpResponse { HttpResponseBuilder::new(self.status_code()) .append_header((header::CONTENT_TYPE, "application/json; charset=UTF-8")) @@ -133,7 +129,6 @@ impl ResponseError for ServiceError { ) } - #[cfg(not(tarpaulin_include))] fn status_code(&self) -> StatusCode { match self { ServiceError::ClosedForRegistration => StatusCode::FORBIDDEN, @@ -177,7 +172,6 @@ impl ResponseError for ServiceError { } impl From for ServiceError { - #[cfg(not(tarpaulin_include))] fn from(e: CredsError) -> ServiceError { match e { CredsError::UsernameCaseMappedError => ServiceError::UsernameCaseMappedError, @@ -192,7 +186,6 @@ impl From for ServiceError { } impl From for ServiceError { - #[cfg(not(tarpaulin_include))] fn from(e: DBError) -> ServiceError { println!("from conversin: {}", e); match e { @@ -208,57 +201,46 @@ impl From for ServiceError { } impl From for ServiceError { - #[cfg(not(tarpaulin_include))] fn from(_: ValidationErrors) -> ServiceError { ServiceError::NotAnEmail } } impl From for ServiceError { - #[cfg(not(tarpaulin_include))] fn from(_: ParseError) -> ServiceError { ServiceError::NotAUrl } } -#[cfg(not(tarpaulin_include))] impl From for ServiceError { fn from(e: CaptchaError) -> ServiceError { ServiceError::CaptchaError(e) } } -#[cfg(not(tarpaulin_include))] impl From for ServiceError { - #[cfg(not(tarpaulin_include))] fn from(e: SmtpError) -> Self { ServiceError::UnableToSendEmail(SmtpErrorWrapper(e)) } } -#[cfg(not(tarpaulin_include))] impl From for ServiceError { - #[cfg(not(tarpaulin_include))] fn from(e: RecvError) -> Self { log::error!("{:?}", e); ServiceError::InternalServerError } } -#[cfg(not(tarpaulin_include))] impl From for ServiceError { - #[cfg(not(tarpaulin_include))] fn from(e: MailboxError) -> Self { log::error!("{:?}", e); ServiceError::InternalServerError } } -#[cfg(not(tarpaulin_include))] pub type ServiceResult = std::result::Result; #[derive(Debug, Display, PartialEq, Error)] -#[cfg(not(tarpaulin_include))] pub enum PageError { #[display(fmt = "Something weng wrong: Internal server error")] InternalServerError, @@ -267,17 +249,13 @@ pub enum PageError { ServiceError(ServiceError), } -#[cfg(not(tarpaulin_include))] impl From for PageError { - #[cfg(not(tarpaulin_include))] fn from(e: ServiceError) -> Self { PageError::ServiceError(e) } } -#[cfg(not(tarpaulin_include))] impl From for PageError { - #[cfg(not(tarpaulin_include))] fn from(e: DBError) -> Self { let se: ServiceError = e.into(); se.into() @@ -297,7 +275,6 @@ impl ResponseError for PageError { } } - #[cfg(not(tarpaulin_include))] fn status_code(&self) -> StatusCode { match self { PageError::InternalServerError => StatusCode::INTERNAL_SERVER_ERROR, @@ -306,7 +283,6 @@ impl ResponseError for PageError { } } -#[cfg(not(tarpaulin_include))] pub type PageResult = std::result::Result; #[cfg(test)] diff --git a/src/main.rs b/src/main.rs index 2366a2b9..57e097db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -92,7 +92,6 @@ pub const CACHE_AGE: u32 = 604800; pub type ArcData = Arc; pub type AppData = actix_web::web::Data; -#[cfg(not(tarpaulin_include))] #[actix_web::main] async fn main() -> std::io::Result<()> { use std::time::Duration; @@ -185,7 +184,6 @@ async fn main() -> std::io::Result<()> { Ok(()) } -#[cfg(not(tarpaulin_include))] pub fn get_json_err() -> JsonConfig { JsonConfig::default().error_handler(|err, _| { //debug!("JSON deserialization error: {:?}", &err); @@ -193,7 +191,6 @@ pub fn get_json_err() -> JsonConfig { }) } -#[cfg(not(tarpaulin_include))] pub fn get_identity_service( settings: &Settings, ) -> IdentityService { diff --git a/src/pages/mod.rs b/src/pages/mod.rs index 7377be71..9c0ec26a 100644 --- a/src/pages/mod.rs +++ b/src/pages/mod.rs @@ -25,7 +25,6 @@ pub fn get_middleware() -> Authentication { Authentication::with_identity(routes::ROUTES) } -#[cfg(not(tarpaulin_include))] #[cfg(test)] mod tests { use actix_web::http::StatusCode; diff --git a/src/settings.rs b/src/settings.rs index e0ecf056..e699977c 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -56,7 +56,6 @@ pub struct Smtp { } impl Server { - #[cfg(not(tarpaulin_include))] pub fn get_ip(&self) -> String { format!("{}:{}", self.ip, self.port) } @@ -205,7 +204,6 @@ const DEPRECATED_ENV_VARS: [(&str, &str); 23] = [ ("smtp.port", "MCAPTCHA_SMTP_PORT"), ]; -#[cfg(not(tarpaulin_include))] impl Settings { pub fn new() -> Result { let mut s = Config::builder();