Skip to content

Commit d3d5e39

Browse files
jswrennhawkw
andcommitted
apply various suggestions from @hawkw
Co-authored-by: Eliza Weisman <[email protected]>
1 parent 7e740c6 commit d3d5e39

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

src/cmd/set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl Set {
131131
skip(self, db, dst),
132132
fields(
133133
key = self.key.as_str(),
134-
?expire = self.expire.as_ref().map(Duration::as_secs_f64),
134+
expire = ?self.expire.as_ref(),
135135
),
136136
)]
137137
pub(crate) async fn apply(self, db: &Db, dst: &mut Connection) -> crate::Result<()> {

src/connection.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ impl Connection {
8484
ConnectionState::Open => continue,
8585
ConnectionState::Closed | ConnectionState::Reset => {
8686
if !self.buffer.is_empty() {
87-
warn! {
88-
incomplete =? self.buffer,
89-
"connection closed with incomplete frame"
90-
};
87+
warn!(
88+
incomplete = ?self.buffer,
89+
"connection closed with incomplete frame",
90+
);
9191
}
9292
return Ok(None);
9393
}
@@ -104,9 +104,7 @@ impl Connection {
104104
Ok(_) => Ok(ConnectionState::Open),
105105
// the connection was closed abruptly by the peer
106106
Err(e) if e.kind() == ConnectionReset => {
107-
warn! {
108-
"connection closed abruptly by peer"
109-
};
107+
warn!("connection closed abruptly by peer");
110108
Ok(ConnectionState::Reset)
111109
}
112110
// reading failed for some other reason

src/db.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,7 @@ impl Shared {
329329
}
330330

331331
// The key expired, remove it
332-
debug! {
333-
key = &key.as_str(),
334-
"purged_expired_key",
335-
}
332+
debug!(key = &key.as_str(), "purged_expired_key");
336333
state.entries.remove(key);
337334
state.expirations.remove(&(when, id));
338335
}

src/server.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl Handler {
323323
name = "Handler::run",
324324
skip(self),
325325
fields(
326-
?peer_addr = self.connection.peer_addr().unwrap(),
326+
peer_addr = %self.connection.peer_addr().unwrap(),
327327
),
328328
)]
329329
async fn run(&mut self) -> crate::Result<()> {
@@ -378,10 +378,7 @@ impl Handler {
378378
// };
379379
// `tracing` provides structured logging, so information is
380380
// "logged" as key-value pairs.
381-
warn! {
382-
%cause,
383-
"failed to parse command from frame"
384-
};
381+
warn!(%cause, "failed to parse command from frame");
385382
// ...and (2) respond to the client with the error:
386383
Command::from_error(cause)
387384
}

0 commit comments

Comments
 (0)