Add exclusions for code coverage

This commit is contained in:
Edward Shen 2021-07-20 16:47:04 -04:00
parent 7bbbf44328
commit 0300135a6a
Signed by: edward
GPG key ID: F350507060ED6C90
7 changed files with 14 additions and 1 deletions

5
src/cache/mem.rs vendored
View file

@ -86,6 +86,7 @@ pub trait InternalMemoryCache: Sync + Send {
fn pop(&mut self) -> Option<(CacheKey, CacheValue)>; fn pop(&mut self) -> Option<(CacheKey, CacheValue)>;
} }
#[cfg(not(tarpaulin_include))]
impl InternalMemoryCacheInitializer for Lfu { impl InternalMemoryCacheInitializer for Lfu {
#[inline] #[inline]
fn new() -> Self { fn new() -> Self {
@ -93,6 +94,7 @@ impl InternalMemoryCacheInitializer for Lfu {
} }
} }
#[cfg(not(tarpaulin_include))]
impl InternalMemoryCache for Lfu { impl InternalMemoryCache for Lfu {
#[inline] #[inline]
fn get(&mut self, key: &CacheKey) -> Option<Cow<CacheValue>> { fn get(&mut self, key: &CacheKey) -> Option<Cow<CacheValue>> {
@ -110,6 +112,7 @@ impl InternalMemoryCache for Lfu {
} }
} }
#[cfg(not(tarpaulin_include))]
impl InternalMemoryCacheInitializer for Lru { impl InternalMemoryCacheInitializer for Lru {
#[inline] #[inline]
fn new() -> Self { fn new() -> Self {
@ -117,6 +120,7 @@ impl InternalMemoryCacheInitializer for Lru {
} }
} }
#[cfg(not(tarpaulin_include))]
impl InternalMemoryCache for Lru { impl InternalMemoryCache for Lru {
#[inline] #[inline]
fn get(&mut self, key: &CacheKey) -> Option<Cow<CacheValue>> { fn get(&mut self, key: &CacheKey) -> Option<Cow<CacheValue>> {
@ -134,6 +138,7 @@ impl InternalMemoryCache for Lru {
} }
} }
#[cfg(not(tarpaulin_include))]
impl InternalMemoryCache for RedisClient { impl InternalMemoryCache for RedisClient {
fn get(&mut self, key: &CacheKey) -> Option<Cow<CacheValue>> { fn get(&mut self, key: &CacheKey) -> Option<Cow<CacheValue>> {
Commands::get(self, key).ok().map(Cow::Owned) Commands::get(self, key).ok().map(Cow::Owned)

1
src/cache/mod.rs vendored
View file

@ -229,6 +229,7 @@ pub trait CallbackCache: Cache {
#[async_trait] #[async_trait]
impl<T: CallbackCache> CallbackCache for Arc<T> { impl<T: CallbackCache> CallbackCache for Arc<T> {
#[inline] #[inline]
#[cfg(not(tarpaulin_include))]
async fn put_with_on_completed_callback( async fn put_with_on_completed_callback(
&self, &self,
key: CacheKey, key: CacheKey,

View file

@ -45,6 +45,7 @@ pub static HTTP_CLIENT: Lazy<CachingClient> = Lazy::new(|| {
} }
}); });
#[cfg(not(tarpaulin_include))]
pub static DEFAULT_HEADERS: Lazy<HeaderMap> = Lazy::new(|| { pub static DEFAULT_HEADERS: Lazy<HeaderMap> = Lazy::new(|| {
let mut headers = HeaderMap::with_capacity(8); let mut headers = HeaderMap::with_capacity(8);
headers.insert(X_CONTENT_TYPE_OPTIONS, HeaderValue::from_static("nosniff")); headers.insert(X_CONTENT_TYPE_OPTIONS, HeaderValue::from_static("nosniff"));

View file

@ -42,7 +42,6 @@ mod metrics;
mod ping; mod ping;
mod routes; mod routes;
mod state; mod state;
#[cfg(not(tarpaulin_include))]
mod stop; mod stop;
mod units; mod units;
@ -252,6 +251,7 @@ enum InvalidCombination {
MissingUnstableOption(&'static str, UnstableOptions), MissingUnstableOption(&'static str, UnstableOptions),
} }
#[cfg(not(tarpaulin_include))]
impl Display for InvalidCombination { impl Display for InvalidCombination {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
@ -268,6 +268,7 @@ impl Display for InvalidCombination {
impl Error for InvalidCombination {} impl Error for InvalidCombination {}
#[cfg(not(tarpaulin_include))]
fn print_preamble_and_warnings(args: &Config) -> Result<(), Box<dyn Error>> { fn print_preamble_and_warnings(args: &Config) -> Result<(), Box<dyn Error>> {
let build_string = option_env!("VERGEN_GIT_SHA_SHORT") let build_string = option_env!("VERGEN_GIT_SHA_SHORT")
.map(|git_sha| format!(" ({})", git_sha)) .map(|git_sha| format!(" ({})", git_sha))

View file

@ -1,3 +1,5 @@
#![cfg(not(tarpaulin_include))]
use std::fs::metadata; use std::fs::metadata;
use std::hint::unreachable_unchecked; use std::hint::unreachable_unchecked;
use std::time::SystemTime; use std::time::SystemTime;

View file

@ -162,6 +162,7 @@ impl<'de> Deserialize<'de> for Tls {
} }
} }
#[cfg(not(tarpaulin_include))]
impl std::fmt::Debug for Tls { impl std::fmt::Debug for Tls {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Tls") f.debug_struct("Tls")

View file

@ -1,3 +1,5 @@
#![cfg(not(tarpaulin_include))]
use reqwest::StatusCode; use reqwest::StatusCode;
use serde::Serialize; use serde::Serialize;
use tracing::{info, warn}; use tracing::{info, warn};