Skip to content

Commit b1ba591

Browse files
authored
clean clippy warnings (#209)
1 parent 73ac0ba commit b1ba591

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

examples/keys_pos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn keys_pos(ctx: &Context, args: Vec<RedisString>) -> RedisResult {
2020

2121
let reply: Vec<_> = args.iter().skip(1).step_by(2).collect();
2222

23-
return Ok(reply.into());
23+
Ok(reply.into())
2424
}
2525

2626
//////////////////////////////////////////////////////

src/context/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl Context {
141141
CString::new(
142142
s.chars()
143143
.map(|c| match c {
144-
'\r' | '\n' => ' ' as u8,
144+
'\r' | '\n' => b' ',
145145
_ => c as u8,
146146
})
147147
.collect::<Vec<_>>(),

src/key.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ where
459459
let mut values_raw = [std::ptr::null_mut(); BATCH_SIZE];
460460

461461
for chunk_fields in fields.chunks(BATCH_SIZE) {
462-
let mut chunk_values = &mut values_raw[..chunk_fields.len()];
463-
raw::hash_get_multi(key, chunk_fields, &mut chunk_values)?;
462+
let chunk_values = &mut values_raw[..chunk_fields.len()];
463+
raw::hash_get_multi(key, chunk_fields, chunk_values)?;
464464
values.extend(chunk_values.iter().map(|ptr| {
465465
if ptr.is_null() {
466466
None

src/redismodule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl RedisString {
142142
Self::from_ptr(self.inner).map_err(|_| RedisError::Str("Couldn't parse as UTF-8 string"))
143143
}
144144

145-
pub fn as_slice<'a>(&self) -> &[u8] {
145+
pub fn as_slice(&self) -> &[u8] {
146146
Self::string_as_slice(self.inner)
147147
}
148148

tests/integration.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn test_hello() -> Result<()> {
2020

2121
let res: Result<Vec<i32>, RedisError> =
2222
redis::cmd("hello.mul").arg(&["3", "xx"]).query(&mut con);
23-
if let Ok(_) = res {
23+
if res.is_ok() {
2424
return Err(anyhow::Error::msg("Should return an error"));
2525
}
2626

@@ -42,7 +42,7 @@ fn test_keys_pos() -> Result<()> {
4242

4343
let res: Result<Vec<String>, RedisError> =
4444
redis::cmd("keys_pos").arg(&["a", "1", "b"]).query(&mut con);
45-
if let Ok(_) = res {
45+
if res.is_ok() {
4646
return Err(anyhow::Error::msg("Shold return an error"));
4747
}
4848

tests/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub fn get_redis_connection(port: u64) -> Result<Connection> {
8080
// Redis not ready yet, sleep and retry
8181
std::thread::sleep(Duration::from_millis(50));
8282
} else {
83-
Err(e)?;
83+
return Err(e.into());
8484
}
8585
}
8686
}

0 commit comments

Comments
 (0)