core: fix warnings when compiling without std
#2022
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, compiling
tracing-core
withdefault-features = false
(i.e. for
no_std
targets) emits a few warnings. This is due to thespinlock implementation's use of the deprecated
atomic::spin_loop_hint
function (renamed to
hint::spin_loop
), and the use of deprecatedcompare_and_swap
instead ofcompare_exchange
methods. Now that ourMSRV is 1.49 (the version in which
hint::spin_loop
was stabilized), wecan fix these warnings.
Solution
This branch replaces the deprecated APIs.
Also, I noticed that one of the tests emits unused-imports warnings with
--no-default-features
. This is because the actual tests are featureflagged to require
std
, but the module itself doesn't, so the importsare just hanging out and not getting used for anything. I went ahead and
fixed that as well.