Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more backports #1220

Merged
merged 2 commits into from
Feb 4, 2021
Merged

more backports #1220

merged 2 commits into from
Feb 4, 2021

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Feb 4, 2021

this backports #1218 and #1167 to v0.1.x

jtescher and others added 2 commits February 4, 2021 11:26
This patch resolves the field value capitalization ambiguity currently
in `otel.kind` by instead recommending an enum value. This also brings
type safety to the value, further reducing the risk of typos and other
misuse.

Resolves #1209
Motivation
----------

The closure generated by `#[instrument(err)]` for non-async functions is
not mutable, preventing any captured variables from being mutated. If a
function has any mutable parameters that are modified within the
function, adding the `#[instrument(err)]` attribute will result in a
compiler error.

Solution
--------

This change makes it so the closure is executed directly as a temporary
variable instead of storing it in a named variable prior to its use,
avoiding the need to explicitly declare it as mutable altogether or to
add an `#[allow(unused_mut)]` annotation on the closure declaration to
silence lint warnings for closures that do not need to be mutable.
@hawkw hawkw requested review from jtescher and a team as code owners February 4, 2021 19:30
@hawkw hawkw merged commit 72eb468 into v0.1.x Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants