matrix-sdk: Fix the tarpaulin skip directives.

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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