fix(controller/reporting):reduce unnecessary mutability exposure
This commit is contained in:
parent
2020b32021
commit
74e49e25d2
1 changed files with 18 additions and 9 deletions
|
|
@ -83,8 +83,11 @@ where
|
||||||
S: Subscriber + for<'a> LookupSpan<'a>,
|
S: Subscriber + for<'a> LookupSpan<'a>,
|
||||||
{
|
{
|
||||||
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>) {
|
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>) {
|
||||||
let mut fields = SpanFields::default();
|
let fields = {
|
||||||
attrs.record(&mut fields);
|
let mut fields = SpanFields::default();
|
||||||
|
attrs.record(&mut fields);
|
||||||
|
fields
|
||||||
|
};
|
||||||
|
|
||||||
if fields.has_any_fields()
|
if fields.has_any_fields()
|
||||||
&& let Some(span) = ctx.span(id)
|
&& let Some(span) = ctx.span(id)
|
||||||
|
|
@ -104,19 +107,25 @@ where
|
||||||
};
|
};
|
||||||
|
|
||||||
// construct & check event fields
|
// construct & check event fields
|
||||||
let mut span_fields = SpanFields::default();
|
let span_fields = {
|
||||||
for span in scope.from_root() {
|
let mut fields = SpanFields::default();
|
||||||
if let Some(fields) = span.extensions().get::<SpanFields>() {
|
for span in scope.from_root() {
|
||||||
span_fields.under(fields);
|
if let Some(span_fields) = span.extensions().get::<SpanFields>() {
|
||||||
|
fields.under(span_fields);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
fields
|
||||||
|
};
|
||||||
if !span_fields.check_fields() {
|
if !span_fields.check_fields() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// construct & check pro fields
|
// construct & check pro fields
|
||||||
let mut event_fields = EventFields::default();
|
let event_fields = {
|
||||||
event.record(&mut event_fields);
|
let mut fields = EventFields::default();
|
||||||
|
event.record(&mut fields);
|
||||||
|
fields
|
||||||
|
};
|
||||||
if !event_fields.check_fields() {
|
if !event_fields.check_fields() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue