Skip to content

Commit 828391a

Browse files
committed
rustfmt
1 parent 96dcf3d commit 828391a

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/cmap/options.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use std::{sync::Arc, time::Duration};
21
#[cfg(test)]
32
use std::cmp::Ordering;
3+
use std::{sync::Arc, time::Duration};
44

55
use derivative::Derivative;
6-
use serde::{Deserialize};
76
#[cfg(test)]
87
use serde::de::{Deserializer, Error};
8+
use serde::Deserialize;
99
use typed_builder::TypedBuilder;
1010

1111
use crate::{
@@ -46,7 +46,11 @@ pub(crate) struct ConnectionPoolOptions {
4646

4747
/// Interval between background thread maintenance runs (e.g. ensure minPoolSize).
4848
#[cfg(test)]
49-
#[serde(default, rename = "backgroundThreadIntervalMS", deserialize_with = "BackgroundThreadInterval::deserialize_from_i64_millis")]
49+
#[serde(
50+
default,
51+
rename = "backgroundThreadIntervalMS",
52+
deserialize_with = "BackgroundThreadInterval::deserialize_from_i64_millis"
53+
)]
5054
pub(crate) background_thread_interval: Option<BackgroundThreadInterval>,
5155

5256
/// Connections that have been ready for usage in the pool for longer than `max_idle_time` will
@@ -136,11 +140,17 @@ impl BackgroundThreadInterval {
136140
D: Deserializer<'de>,
137141
{
138142
let millis = Option::<i64>::deserialize(deserializer)?;
139-
let millis = if let Some(m) = millis { m } else { return Ok(None) };
143+
let millis = if let Some(m) = millis {
144+
m
145+
} else {
146+
return Ok(None);
147+
};
140148
Ok(Some(match millis.cmp(&0) {
141149
Ordering::Less => BackgroundThreadInterval::Never,
142150
Ordering::Equal => return Err(D::Error::custom("zero is not allowed")),
143-
Ordering::Greater => BackgroundThreadInterval::Every(Duration::from_millis(millis as u64)),
151+
Ordering::Greater => {
152+
BackgroundThreadInterval::Every(Duration::from_millis(millis as u64))
153+
}
144154
}))
145155
}
146156
}

src/cmap/worker.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use derivative::Derivative;
22

3+
#[cfg(test)]
4+
use super::options::BackgroundThreadInterval;
35
use super::{
46
conn::PendingConnection,
57
connection_requester,
@@ -18,8 +20,6 @@ use super::{
1820
Connection,
1921
DEFAULT_MAX_POOL_SIZE,
2022
};
21-
#[cfg(test)]
22-
use super::options::BackgroundThreadInterval;
2323
use crate::{
2424
error::{Error, ErrorKind, Result},
2525
event::cmap::{

0 commit comments

Comments
 (0)