Refactor: tidy up imports and features #26
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.
Hello there! Just wanted to send in a PR that cleans up the feature-gated imports for this crate. To make the review easier, I made sure to neatly separate each commit according to their purpose.
std
impliesalloc
The first major change I did was to adjust the feature list so that
std
now impliesalloc
. That way, we no longer have to check the conditionany(feature = "std", feature = "alloc")
anymore.As much as possible, I imported from
core
. I only imported from the feature-gatedalloc
andstd
crates when absolutely necessary (and as a last resort).std
not necessary?After restructuring the imports and features, I noticed that many of the imported items were actually unused. Namely:
alloc::collections::{BTreeMap, BTreeSet}
core::hash::{BuildHasher, Hash}
std::collections::{HashMap, HashSet}
In fact, the only item from
alloc
that the crate directly uses isalloc::boxed::Box
.1 All other imports fromalloc
andstd
are unused. I have thus taken the liberty in removing them.But, this does introduce an interesting situation: the
std
feature is actually unused now! We can completely remove it from the crate's exposedfeatures
.I'm not exactly sure why this is the case. The documentation mentions that the crate:
Nevertheless, I've removed the
std
feature because it is indeed unused. Implementing the missing features is beyond the scope of this PR. Future PRs may want to consider upholding thatstd
impliesalloc
whenstd
is re-introduced into the crate.Fixing some Clippy lints...
When the errors finally disappeared, I noticed a bunch of Clippy warnings. These have been addressed as well. Please see the aptly named commit message for the (rather mechanical) changes.
Fixing some outdated doc-comments...
One of the doc-comments uses the now-removed
FromFallibleIterator
trait, which causes the example tests to fail. I've resolved this issue.Bumping the MSRV to
1.36
See #26 (comment).
Footnotes
The
Box
import was used toimpl
theFallibleIterator
trait for boxed iterators (i.e.Box<I: FallibleIterator>
. ↩