Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Dyas committed May 24, 2022
1 parent 92181ab commit 873fa5b
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions redis-test/src/mock_conn.rs
Expand Up @@ -2,14 +2,13 @@ use std::collections::VecDeque;
use std::iter::FromIterator;
use std::sync::{Arc, Mutex};

use redis::{Cmd, Value, RedisError, Pipeline, ConnectionLike, ErrorKind, RedisResult};
use redis::{Cmd, ConnectionLike, ErrorKind, Pipeline, RedisError, RedisResult, Value};

#[cfg(feature = "aio")]
use futures::{future, FutureExt};

#[cfg(feature = "aio")]
use crate::{RedisFuture, aio::ConnectionLike as AioConnectionLike};

use crate::{aio::ConnectionLike as AioConnectionLike, RedisFuture};

/// Helper trait for converting test values into a `redis::Value` returned from a
/// `MockRedisConnection`. This is necessary because neither `redis::types::ToRedisArgs`
Expand Down Expand Up @@ -109,9 +108,9 @@ impl MockCmd {
/// Create a new `MockCmd` given a Redis command and either a value convertible to
/// a `redis::Value` or a `RedisError`.
pub fn new<C, V>(cmd: C, response: Result<V, RedisError>) -> Self
where
C: IntoRedisCmdBytes,
V: IntoRedisValue,
where
C: IntoRedisCmdBytes,
V: IntoRedisValue,
{
MockCmd {
cmd_bytes: cmd.into_redis_cmd_bytes(),
Expand All @@ -122,9 +121,9 @@ impl MockCmd {
/// Create a new `MockCommand` given a Redis command/pipeline and a vector of value convertible
/// to a `redis::Value` or a `RedisError`.
pub fn with_values<C, V>(cmd: C, responses: Result<Vec<V>, RedisError>) -> Self
where
C: IntoRedisCmdBytes,
V: IntoRedisValue,
where
C: IntoRedisCmdBytes,
V: IntoRedisValue,
{
MockCmd {
cmd_bytes: cmd.into_redis_cmd_bytes(),
Expand All @@ -143,8 +142,8 @@ pub struct MockRedisConnection {
impl MockRedisConnection {
/// Construct a new from the given sequence of commands.
pub fn new<I>(commands: I) -> Self
where
I: IntoIterator<Item = MockCmd>,
where
I: IntoIterator<Item = MockCmd>,
{
MockRedisConnection {
commands: Arc::new(Mutex::new(VecDeque::from_iter(commands))),
Expand Down Expand Up @@ -269,7 +268,7 @@ impl AioConnectionLike for MockRedisConnection {

#[cfg(test)]
mod tests {
use super::{MockRedisConnection, MockCmd};
use super::{MockCmd, MockRedisConnection};
use redis::{cmd, pipe, ErrorKind, Value};

#[test]
Expand Down

0 comments on commit 873fa5b

Please sign in to comment.