Browse Source

Fix dead code warnings

drone-volume-cache
Alex Mikhalev 4 years ago
parent
commit
53bd7c6679
  1. 1
      src/model/section.rs
  2. 1
      src/section_interface.rs
  3. 6
      src/section_runner.rs

1
src/model/section.rs

@ -18,6 +18,7 @@ impl Section {
}) })
} }
#[allow(dead_code)]
pub fn as_sql(&self) -> Vec<&dyn ToSql> { pub fn as_sql(&self) -> Vec<&dyn ToSql> {
vec![&self.id, &self.name, &self.interface_id] vec![&self.id, &self.name, &self.interface_id]
} }

1
src/section_interface.rs

@ -15,6 +15,7 @@ pub struct MockSectionInterface {
} }
impl MockSectionInterface { impl MockSectionInterface {
#[allow(dead_code)]
pub fn new(num_sections: SectionId) -> Self { pub fn new(num_sections: SectionId) -> Self {
Self { Self {
states: repeat_with(|| AtomicBool::new(false)) states: repeat_with(|| AtomicBool::new(false))

6
src/section_runner.rs

@ -76,6 +76,7 @@ impl SecRun {
self.start_time.map(|t| t.elapsed()) self.start_time.map(|t| t.elapsed())
} }
#[allow(dead_code)]
fn is_done(&self) -> Option<bool> { fn is_done(&self) -> Option<bool> {
self.elapsed().map(|elapsed| elapsed >= self.duration) self.elapsed().map(|elapsed| elapsed >= self.duration)
} }
@ -210,6 +211,7 @@ pub struct SectionRunner {
msg_send: mpsc::Sender<RunnerMsg>, msg_send: mpsc::Sender<RunnerMsg>,
} }
#[allow(dead_code)]
impl SectionRunner { impl SectionRunner {
pub fn new(interface: Arc<dyn SectionInterface + Sync>) -> Self { pub fn new(interface: Arc<dyn SectionInterface + Sync>) -> Self {
let (msg_send, msg_recv) = mpsc::channel(8); let (msg_send, msg_recv) = mpsc::channel(8);
@ -326,7 +328,7 @@ mod test {
async fn advance(dur: Duration) { async fn advance(dur: Duration) {
// HACK: advance should really be enough, but we need another yield_now // HACK: advance should really be enough, but we need another yield_now
tokio::time::advance(Duration::from_secs(10)).await; tokio::time::advance(dur).await;
tokio::task::yield_now().await; tokio::task::yield_now().await;
} }
@ -393,7 +395,7 @@ mod test {
.await .await
.unwrap(); .unwrap();
let run2 = runner let _run2 = runner
.queue_run(sections[0].clone(), Duration::from_secs(10)) .queue_run(sections[0].clone(), Duration::from_secs(10))
.await .await
.unwrap(); .unwrap();

Loading…
Cancel
Save