chore: lint `lifecycle` crate

pull/24376/head
Marco Neumann 2021-06-22 11:05:55 +02:00
parent f79349bce0
commit 7f188c3c94
3 changed files with 36 additions and 2 deletions

View File

@ -82,7 +82,10 @@
//! ```
//!
use std::ops::{Deref, DerefMut};
use std::{
fmt::Debug,
ops::{Deref, DerefMut},
};
use tracker::{RwLock, RwLockUpgradableReadGuard, RwLockWriteGuard};
@ -126,6 +129,12 @@ impl<'a, P, D> LifecycleReadGuard<'a, P, D> {
}
}
impl<'a, P, D> Debug for LifecycleReadGuard<'a, P, D> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "LifecycleReadGuard{{..}}")
}
}
impl<'a, P, D> Deref for LifecycleReadGuard<'a, P, D> {
type Target = P;
#[inline]
@ -164,6 +173,12 @@ impl<'a, P, D> LifecycleWriteGuard<'a, P, D> {
}
}
impl<'a, P, D> Debug for LifecycleWriteGuard<'a, P, D> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "LifecycleWriteGuard{{..}}")
}
}
impl<'a, P, D> Deref for LifecycleWriteGuard<'a, P, D> {
type Target = P;
#[inline]

View File

@ -1,3 +1,12 @@
#![deny(broken_intra_doc_links, rust_2018_idioms)]
#![warn(
missing_copy_implementations,
missing_debug_implementations,
clippy::explicit_iter_loop,
clippy::future_not_send,
clippy::use_self,
clippy::clone_on_ref_ptr
)]
use chrono::{DateTime, Utc};
use data_types::chunk_metadata::ChunkStorage;
@ -92,7 +101,7 @@ pub trait LockableChunk: Sized {
/// Note that this can only be called for persisted chunks
/// (otherwise the read buffer may contain the *only* copy of this
/// chunk's data). In order to drop un-persisted chunks,
/// [`drop_chunk`](Self::drop_chunk) must be used.
/// [`drop_chunk`](LifecycleDb::drop_chunk) must be used.
fn unload_read_buffer(s: LifecycleWriteGuard<'_, Self::Chunk, Self>)
-> Result<(), Self::Error>;
}

View File

@ -1,4 +1,5 @@
use std::convert::TryInto;
use std::fmt::Debug;
use std::time::{Duration, Instant};
use chrono::{DateTime, Utc};
@ -222,6 +223,15 @@ where
}
}
impl<'a, M> Debug for LifecyclePolicy<'a, M>
where
&'a M: LifecycleDb,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "LifecyclePolicy{{..}}")
}
}
/// Completes when the provided tracker completes or never if None provided
async fn wait_optional_tracker<Job: Send + Sync + 'static>(tracker: Option<TaskTracker<Job>>) {
match tracker {