Skip to content

Commit

Permalink
refactor: remove wildcard imports from time_extent.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
da2ce7 committed Feb 10, 2023
1 parent 8e85f18 commit 178dcbe
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions src/protocol/clock/time_extent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,15 @@ pub type DefaultTimeExtentMaker = StoppedTimeExtentMaker;

#[cfg(test)]
mod test {

use crate::protocol::clock::time_extent::{
checked_duration_from_nanos, Base, DefaultTimeExtentMaker, Extent, Make, Multiplier, Product, TimeExtent, MAX, ZERO,
};
use crate::protocol::clock::{Current, DurationSinceUnixEpoch, StoppedTime};
use super::TimeExtent;

const TIME_EXTENT_VAL: TimeExtent = TimeExtent::from_sec(2, &239_812_388_723);

mod fn_checked_duration_from_nanos {
use std::time::Duration;

use super::*;
use crate::protocol::clock::time_extent::checked_duration_from_nanos;
use crate::protocol::clock::time_extent::test::TIME_EXTENT_VAL;

const NANOS_PER_SEC: u32 = 1_000_000_000;

Expand Down Expand Up @@ -225,11 +222,9 @@ mod test {
}

mod time_extent {
use super::*;

mod fn_default {

use super::*;
use crate::protocol::clock::time_extent::{TimeExtent, ZERO};

#[test]
fn it_should_default_initialize_to_zero() {
Expand All @@ -238,7 +233,8 @@ mod test {
}

mod fn_from_sec {
use super::*;
use crate::protocol::clock::time_extent::test::TIME_EXTENT_VAL;
use crate::protocol::clock::time_extent::{Multiplier, TimeExtent, ZERO};

#[test]
fn it_should_make_empty_for_zero() {
Expand All @@ -254,7 +250,8 @@ mod test {
}

mod fn_new {
use super::*;
use crate::protocol::clock::time_extent::test::TIME_EXTENT_VAL;
use crate::protocol::clock::time_extent::{Base, Extent, Multiplier, TimeExtent, ZERO};

#[test]
fn it_should_make_empty_for_zero() {
Expand All @@ -276,7 +273,8 @@ mod test {
mod fn_increase {
use std::num::IntErrorKind;

use super::*;
use crate::protocol::clock::time_extent::test::TIME_EXTENT_VAL;
use crate::protocol::clock::time_extent::{Extent, TimeExtent, ZERO};

#[test]
fn it_should_not_increase_for_zero() {
Expand All @@ -303,7 +301,8 @@ mod test {
mod fn_decrease {
use std::num::IntErrorKind;

use super::*;
use crate::protocol::clock::time_extent::test::TIME_EXTENT_VAL;
use crate::protocol::clock::time_extent::{Extent, TimeExtent, ZERO};

#[test]
fn it_should_not_decrease_for_zero() {
Expand All @@ -328,7 +327,8 @@ mod test {
}

mod fn_total {
use super::*;
use crate::protocol::clock::time_extent::test::TIME_EXTENT_VAL;
use crate::protocol::clock::time_extent::{Base, Extent, Product, TimeExtent, MAX, ZERO};

#[test]
fn it_should_be_zero_for_zero() {
Expand Down Expand Up @@ -375,7 +375,8 @@ mod test {
}

mod fn_total_next {
use super::*;
use crate::protocol::clock::time_extent::test::TIME_EXTENT_VAL;
use crate::protocol::clock::time_extent::{Base, Extent, Product, TimeExtent, MAX, ZERO};

#[test]
fn it_should_be_zero_for_zero() {
Expand Down Expand Up @@ -429,10 +430,11 @@ mod test {
}

mod make_time_extent {
use super::*;

mod fn_now {
use super::*;
use crate::protocol::clock::time_extent::test::TIME_EXTENT_VAL;
use crate::protocol::clock::time_extent::{Base, DefaultTimeExtentMaker, Make, TimeExtent};
use crate::protocol::clock::{Current, DurationSinceUnixEpoch, StoppedTime};

#[test]
fn it_should_give_a_time_extent() {
Expand Down Expand Up @@ -470,7 +472,9 @@ mod test {
mod fn_now_after {
use std::time::Duration;

use super::*;
use crate::protocol::clock::time_extent::test::TIME_EXTENT_VAL;
use crate::protocol::clock::time_extent::{Base, DefaultTimeExtentMaker, Make};
use crate::protocol::clock::{Current, DurationSinceUnixEpoch, StoppedTime};

#[test]
fn it_should_give_a_time_extent() {
Expand Down Expand Up @@ -507,7 +511,8 @@ mod test {
mod fn_now_before {
use std::time::Duration;

use super::*;
use crate::protocol::clock::time_extent::{Base, DefaultTimeExtentMaker, Make, TimeExtent};
use crate::protocol::clock::{Current, DurationSinceUnixEpoch, StoppedTime};

#[test]
fn it_should_give_a_time_extent() {
Expand Down

0 comments on commit 178dcbe

Please sign in to comment.