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>,
|
||||
{
|
||||
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>) {
|
||||
let mut fields = SpanFields::default();
|
||||
attrs.record(&mut fields);
|
||||
let fields = {
|
||||
let mut fields = SpanFields::default();
|
||||
attrs.record(&mut fields);
|
||||
fields
|
||||
};
|
||||
|
||||
if fields.has_any_fields()
|
||||
&& let Some(span) = ctx.span(id)
|
||||
|
|
@ -104,19 +107,25 @@ where
|
|||
};
|
||||
|
||||
// construct & check event fields
|
||||
let mut span_fields = SpanFields::default();
|
||||
for span in scope.from_root() {
|
||||
if let Some(fields) = span.extensions().get::<SpanFields>() {
|
||||
span_fields.under(fields);
|
||||
let span_fields = {
|
||||
let mut fields = SpanFields::default();
|
||||
for span in scope.from_root() {
|
||||
if let Some(span_fields) = span.extensions().get::<SpanFields>() {
|
||||
fields.under(span_fields);
|
||||
}
|
||||
}
|
||||
}
|
||||
fields
|
||||
};
|
||||
if !span_fields.check_fields() {
|
||||
return;
|
||||
}
|
||||
|
||||
// construct & check pro fields
|
||||
let mut event_fields = EventFields::default();
|
||||
event.record(&mut event_fields);
|
||||
let event_fields = {
|
||||
let mut fields = EventFields::default();
|
||||
event.record(&mut fields);
|
||||
fields
|
||||
};
|
||||
if !event_fields.check_fields() {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue