Suggestion for guidelines around std
cargo features
#202
Replies: 2 comments
-
But then how do you abstract over it?
|
Beta Was this translation helpful? Give feedback.
-
Let me start by saying how to import libcore appears to be moot now, as at some point (possibly the 2018 edition) it's imported by default regardless of if That said, that style seems popular among people adding This is because In my experience there are a mixture of styles for gating There's a good reason for that: it gives you a common baseline. |
Beta Was this translation helpful? Give feedback.
-
I have a suggestion for a slight modification to an example given here:
https://rust-lang-nursery.github.io/api-guidelines/naming.html#feature-names-are-free-of-placeholder-words-c-feature
Namely in regard to this:
I would suggest the following instead:
(Note: I'm well aware of efforts to eradicate
extern crate
. Ifuse std
worked here, I'd suggest that instead)The reasons for using the latter form:
Consistently imports(it seems newer Rust versions always import core)core
std
thenno_std
), and generally just easier to tell at a glance what's going onalloc
andstd
traits, but want to always consistently get the macros from one or the otherBeta Was this translation helpful? Give feedback.
All reactions