Skip to content

Commit

Permalink
kodraus feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
  • Loading branch information
yoshuawuyts committed Sep 1, 2019
1 parent a0546ba commit fe1b13e
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1416,32 +1416,8 @@ pub fn __private_api_log(
args: fmt::Arguments<'_>,
level: Level,
&(target, module_path, file, line): &(&str, &'static str, &'static str, u32),
kvs: Option<&[(&str, &str)]>,
kvs: Option<&[(&str, &kv::ToValue)]>,
) {
// Ideally there would be a `From` impl available for this.
struct KeyValues<'a> {
inner: &'a [(&'a str, &'a str)],
}

impl<'a> kv::Source for KeyValues<'a> {
fn visit<'kvs>(&'kvs self, visitor: &mut kv::Visitor<'kvs>) -> Result<(), kv::Error> {
for pair in self.inner {
visitor.visit_pair(pair.0.into(), pair.1.into())?;
}
Ok(())
}

#[inline]
fn count(&self) -> usize {
self.inner.len()
}
}

let kvs = match kvs {
Some(kvs) => Some(KeyValues { inner: kvs }),
None => None,
};

logger().log(
&Record::builder()
.args(args)
Expand Down

0 comments on commit fe1b13e

Please sign in to comment.