Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
khvzak committed Sep 6, 2024
1 parent 87dbf72 commit b9b1673
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions casper-server/src/lua/http/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ impl LuaBody {
match self {
LuaBody::None => Ok(None),
LuaBody::Bytes(bytes) => Ok(Some(bytes.clone())),
_ => Ok(self.read().await?.map(|b| {
_ => Ok(self.read().await?.inspect(|b| {
*self = LuaBody::Bytes(b.clone());
b
})),
}
}
Expand Down
4 changes: 2 additions & 2 deletions casper-server/src/lua/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ where
.into_iter()
.map(|res| match res {
Ok(_) => Ok(Value::Boolean(true)),
Err(err) => Ok(Value::String(lua.create_string(&err.into().to_string())?)),
Err(err) => Ok(Value::String(lua.create_string(err.into().to_string())?)),
})
.collect::<LuaResult<Vec<_>>>()?;
Ok((false, Some(results)))
Expand Down Expand Up @@ -285,7 +285,7 @@ where
.into_iter()
.map(|res| match res {
Ok(size) => Ok(Value::Integer(size as _)),
Err(err) => Ok(Value::String(lua.create_string(&err.into().to_string())?)),
Err(err) => Ok(Value::String(lua.create_string(err.into().to_string())?)),
})
.collect::<LuaResult<Vec<_>>>()?;
Ok((None, Some(results)))
Expand Down
3 changes: 1 addition & 2 deletions casper-server/src/middleware/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,9 @@ where
ResponseBody::Other(Body::from_message(StreamSpan { body, otel_cx }))
})
})
.map_err(|err| {
.inspect_err(|err| {
let span = otel_cx.span();
span.set_status(trace::Status::error(err.to_string()));
err
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions casper-server/src/storage/backends/redis/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ impl RedisBackend {
num_chunks += 1;
// Store chunk in Redis
self.pool
.set(
.set::<(), _, _>(
make_chunk_key(&item.key, i as u32 + 1),
RedisValue::Bytes(chunk.to_vec().into()),
Some(Expiration::EX(ttl as i64)),
Expand Down Expand Up @@ -458,7 +458,7 @@ impl RedisBackend {

// Store response item
self.pool
.set(
.set::<(), _, _>(
make_redis_key(&item.key),
RedisValue::Bytes(response_item_enc.into()),
Some(Expiration::EX(ttl as i64)),
Expand Down Expand Up @@ -505,7 +505,7 @@ impl RedisBackend {
if refresh_ttl && rand::random::<u8>() % 100 < 1 {
// Refresh TTL with 1% probability
self.pool
.expire(make_redis_key(&skey), SURROGATE_KEYS_TTL)
.expire::<(), _>(make_redis_key(&skey), SURROGATE_KEYS_TTL)
.await?;
}
anyhow::Ok(())
Expand Down

0 comments on commit b9b1673

Please sign in to comment.