Skip to content

Commit

Permalink
subscriber: explain why we always call inner.register_callsite() be…
Browse files Browse the repository at this point in the history
…fore if statement
  • Loading branch information
Folyd committed Jun 11, 2021
1 parent 44d3558 commit 617ccfd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tracing-subscriber/src/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,9 @@ where
return outer;
}

// The intention behind calling `inner.register_callsite()` before the if statement
// was to ensure that the inner subscriber is informed that the callsite exists
// regardless of the outer subscriber's filtering decision.
let inner = self.inner.register_callsite(metadata);
if outer.is_sometimes() {
// if this interest is "sometimes", return "sometimes" to ensure that
Expand Down Expand Up @@ -712,6 +715,9 @@ where
return outer;
}

// The intention behind calling `inner.register_callsite()` before the if statement
// was to ensure that the inner subscriber is informed that the callsite exists
// regardless of the outer subscriber's filtering decision.
let inner = self.inner.register_callsite(metadata);
if outer.is_sometimes() {
// if this interest is "sometimes", return "sometimes" to ensure that
Expand Down

0 comments on commit 617ccfd

Please sign in to comment.