Simplify cfg
s and allow testing without default features.
#253
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.
This PR contains two commits which address different matters, but the second depends on and helps test the first. If desired, I can split it into two PRs, or discard either one and keep the other.
First:
no_std
import simplification.It's always OK to use
core
andalloc
if you're usingstd
, andcore
if you're usingalloc
. Therefore, code can be simplified by usingalloc
even ifstd
is also being used, and so on.std
feature depend onalloc
feature.cfg()
s by making that assumption.std
aliased asalloc
; usealloc
directly.These changes do not affect the public API of the crate in any way, but should make maintenance slightly easier since there are fewer subtly-different conditions under which the code might be compiled.
Second: Allow
cargo test
to complete under any set of features.Previously, tests, examples, and benches would fail to compile under
cargo test --no-default-features
. Now they are all skipped if they would not compile.This does not affect behavior with default features — test coverage is not reduced.