matrix-sdk: Fix the tarpaulin skip directives.

master
Damir Jelić 2020-08-11 15:49:04 +02:00
parent d0a5b86ff3
commit 7637e79f2c
9 changed files with 20 additions and 12 deletions

View File

@ -74,7 +74,7 @@ pub struct Client {
pub(crate) base_client: BaseClient, pub(crate) base_client: BaseClient,
} }
// #[cfg_attr(tarpaulin, skip)] #[cfg(not(tarpaulin_include))]
impl Debug for Client { impl Debug for Client {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> StdResult<(), fmt::Error> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> StdResult<(), fmt::Error> {
write!(fmt, "Client {{ homeserver: {} }}", self.homeserver) write!(fmt, "Client {{ homeserver: {} }}", self.homeserver)
@ -115,7 +115,7 @@ pub struct ClientConfig {
timeout: Option<Duration>, timeout: Option<Duration>,
} }
// #[cfg_attr(tarpaulin, skip)] #[cfg(not(tarpaulin_include))]
impl Debug for ClientConfig { impl Debug for ClientConfig {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut res = fmt.debug_struct("ClientConfig"); let mut res = fmt.debug_struct("ClientConfig");

View File

@ -212,7 +212,7 @@ pub struct BaseClient {
store_passphrase: Arc<Zeroizing<String>>, store_passphrase: Arc<Zeroizing<String>>,
} }
// #[cfg_attr(tarpaulin, skip)] #[cfg(not(tarpaulin_include))]
impl fmt::Debug for BaseClient { impl fmt::Debug for BaseClient {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Client") f.debug_struct("Client")
@ -246,7 +246,7 @@ pub struct BaseClientConfig {
passphrase: Option<Zeroizing<String>>, passphrase: Option<Zeroizing<String>>,
} }
// #[cfg_attr(tarpaulin, skip)] #[cfg(not(tarpaulin_include))]
impl std::fmt::Debug for BaseClientConfig { impl std::fmt::Debug for BaseClientConfig {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> StdResult<(), std::fmt::Error> { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> StdResult<(), std::fmt::Error> {
fmt.debug_struct("BaseClientConfig").finish() fmt.debug_struct("BaseClientConfig").finish()

View File

@ -198,7 +198,7 @@ impl Device {
#[cfg(test)] #[cfg(test)]
pub async fn from_machine(machine: &OlmMachine) -> Device { pub async fn from_machine(machine: &OlmMachine) -> Device {
Device::from_account(&machine.account).await Device::from_account(machine.account()).await
} }
#[cfg(test)] #[cfg(test)]

View File

@ -75,7 +75,7 @@ pub struct OlmMachine {
/// The unique device id of the device that holds this account. /// The unique device id of the device that holds this account.
device_id: Box<DeviceId>, device_id: Box<DeviceId>,
/// Our underlying Olm Account holding our identity keys. /// Our underlying Olm Account holding our identity keys.
pub(crate) account: Account, account: Account,
/// Store for the encryption keys. /// Store for the encryption keys.
/// Persists all the encryption keys so a client can resume the session /// Persists all the encryption keys so a client can resume the session
/// without the need to create new keys. /// without the need to create new keys.
@ -87,7 +87,7 @@ pub struct OlmMachine {
verification_machine: VerificationMachine, verification_machine: VerificationMachine,
} }
// #[cfg_attr(tarpaulin, skip)] #[cfg(not(tarpaulin_include))]
impl std::fmt::Debug for OlmMachine { impl std::fmt::Debug for OlmMachine {
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("OlmMachine") f.debug_struct("OlmMachine")
@ -214,6 +214,12 @@ impl OlmMachine {
self.account.should_upload_keys().await self.account.should_upload_keys().await
} }
/// Get the underlying Olm account of the machine.
#[cfg(test)]
pub(crate) fn account(&self) -> &Account {
&self.account
}
/// Update the count of one-time keys that are currently on the server. /// Update the count of one-time keys that are currently on the server.
fn update_key_count(&self, count: u64) { fn update_key_count(&self, count: u64) {
self.account.update_uploaded_key_count(count); self.account.update_uploaded_key_count(count);

View File

@ -63,7 +63,7 @@ pub struct Account {
uploaded_signed_key_count: Arc<AtomicI64>, uploaded_signed_key_count: Arc<AtomicI64>,
} }
// #[cfg_attr(tarpaulin, skip)] #[cfg(not(tarpaulin_include))]
impl fmt::Debug for Account { impl fmt::Debug for Account {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Account") f.debug_struct("Account")

View File

@ -222,7 +222,7 @@ impl InboundGroupSession {
} }
} }
// #[cfg_attr(tarpaulin, skip)] #[cfg(not(tarpaulin_include))]
impl fmt::Debug for InboundGroupSession { impl fmt::Debug for InboundGroupSession {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("InboundGroupSession") f.debug_struct("InboundGroupSession")
@ -401,7 +401,7 @@ impl OutboundGroupSession {
} }
} }
// #[cfg_attr(tarpaulin, skip)] #[cfg(not(tarpaulin_include))]
impl std::fmt::Debug for OutboundGroupSession { impl std::fmt::Debug for OutboundGroupSession {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("OutboundGroupSession") f.debug_struct("OutboundGroupSession")

View File

@ -51,7 +51,7 @@ pub struct Session {
pub(crate) last_use_time: Arc<Instant>, pub(crate) last_use_time: Arc<Instant>,
} }
// #[cfg_attr(tarpaulin, skip)] #[cfg(not(tarpaulin_include))]
impl fmt::Debug for Session { impl fmt::Debug for Session {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Session") f.debug_struct("Session")

View File

@ -880,7 +880,7 @@ impl CryptoStore for SqliteStore {
} }
} }
// #[cfg_attr(tarpaulin, skip)] #[cfg(not(tarpaulin_include))]
impl std::fmt::Debug for SqliteStore { impl std::fmt::Debug for SqliteStore {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> StdResult<(), std::fmt::Error> { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> StdResult<(), std::fmt::Error> {
fmt.debug_struct("SqliteStore") fmt.debug_struct("SqliteStore")

View File

@ -98,6 +98,7 @@ impl TryFrom<AcceptV1Content> for AcceptedProtocols {
} }
} }
#[cfg(not(tarpaulin_include))]
impl Default for AcceptedProtocols { impl Default for AcceptedProtocols {
fn default() -> Self { fn default() -> Self {
AcceptedProtocols { AcceptedProtocols {
@ -146,6 +147,7 @@ pub struct SasState<S: Clone> {
state: Arc<S>, state: Arc<S>,
} }
#[cfg(not(tarpaulin_include))]
impl<S: Clone + std::fmt::Debug> std::fmt::Debug for SasState<S> { impl<S: Clone + std::fmt::Debug> std::fmt::Debug for SasState<S> {
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("SasState") f.debug_struct("SasState")