Style tweaks

This commit is contained in:
David Bürgin 2020-08-05 11:43:50 +02:00
parent 09f9795c14
commit c2848aa91e
2 changed files with 5 additions and 5 deletions

View file

@ -186,9 +186,9 @@ fn handle_body(mut ctx: Context, bytes: &[u8]) -> milter::Result<Status> {
let max = config::get().max_message_size();
Ok(if client.bytes_written() > max {
client.skip_body();
let id = queue_id(&ctx.api)?;
verbose!("{}: skipping rest of message larger than {} bytes", id, max);
client.skip_body();
Status::Skip
} else {
Status::Continue

View file

@ -47,17 +47,17 @@ where
}
}
// Ad-hoc implementation, only does `to_owned` on the lookup key if the key is
// not yet present.
// Ad-hoc implementation, only allocates a lookup key if the key is not yet
// present.
impl<V> StrVecMap<String, V> {
pub fn insert_if_absent<K>(&mut self, key: K, value: V) -> Option<V>
where
K: AsRef<str>,
K: AsRef<str> + Into<String>,
{
if self.contains_key(key.as_ref()) {
Some(value)
} else {
self.entries.push((key.as_ref().to_owned(), value));
self.entries.push((key.into(), value));
None
}
}