Skip to content

Commit

Permalink
Handle missing cases for event! macro
Browse files Browse the repository at this point in the history
The new tests revealed these.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
  • Loading branch information
hawkw committed Jan 4, 2019
1 parent 66dd59f commit 7e54717
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tokio-trace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,9 @@ macro_rules! span {
/// ```
#[macro_export]
macro_rules! event {
// (target: $target:expr, $lvl:expr, { $( $k:ident $( = $val:expr )* ),* }, $fmt:expr ) => (
// event!(target: $target, $lvl, { $($k $( = $val)* ),* }, $fmt, )
// );
(target: $target:expr, $lvl:expr, $( $k:ident $( = $val:expr )* ),+ ) => (
event!(target: $target, $lvl, { $( $k $( = $val)* ),+ })
);
(target: $target:expr, $lvl:expr, { $( $k:ident $( = $val:expr )* ),* }, $($arg:tt)+ ) => ({
{
#[allow(unused_imports)]
Expand Down Expand Up @@ -497,6 +497,9 @@ macro_rules! event {
event
}
});
(target: $target:expr, $lvl:expr, $($arg:tt)+ ) => (
event!(target: $target, $lvl, { }, $($arg)+)
);
( $lvl:expr, { $( $k:ident $( = $val:expr )* ),* }, $($arg:tt)+ ) => (
event!(target: module_path!(), $lvl, { $($k $( = $val)* ),* }, $($arg)+)
);
Expand All @@ -506,7 +509,6 @@ macro_rules! event {
( $lvl:expr, $($arg:tt)+ ) => (
event!(target: module_path!(), $lvl, { }, $($arg)+)
);

(@ record: $ev:expr, $k:expr, $i:expr, $val:expr) => (
$ev.record($i, &$val);
);
Expand Down

0 comments on commit 7e54717

Please sign in to comment.