Skip to content

Commit

Permalink
Short debug format for empty Envelopes
Browse files Browse the repository at this point in the history
  • Loading branch information
rubdos committed Jan 7, 2024
1 parent 38a322f commit b1c24ef
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions libsignal-service/src/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,24 @@ impl<S, R> fmt::Debug for ServiceCipher<S, R> {
}

fn debug_envelope(envelope: &Envelope) -> String {
format!(
"Envelope {{ \
if envelope.content.is_none() {
format!("Envelope {{ empty }}")

Check warning on line 51 in libsignal-service/src/cipher.rs

View workflow job for this annotation

GitHub Actions / clippy

useless use of `format!`

warning: useless use of `format!` --> libsignal-service/src/cipher.rs:51:9 | 51 | format!("Envelope {{ empty }}") | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Envelope { empty }".to_string()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format = note: `#[warn(clippy::useless_format)]` on by default
} else {
format!(
"Envelope {{ \
source_address: {:?}, \
source_device: {:?}, \
server_guid: {:?}, \
timestamp: {:?}, \
content: {} bytes, \
}}",
envelope.source_address(),
envelope.source_device(),
envelope.server_guid(),
envelope.timestamp(),
envelope.content().len(),
)
envelope.source_address(),
envelope.source_device(),
envelope.server_guid(),
envelope.timestamp(),
envelope.content().len(),
)
}
}

impl<S, R> ServiceCipher<S, R>
Expand Down

0 comments on commit b1c24ef

Please sign in to comment.