Skip to content

Commit afb5041

Browse files
authored
descriptors: convert crate to no_std (twitchyliquid64#54)
Converts the `descriptors` crate to `no_std` to avoid indirect dependency on the `std` library in a `no_std` crate.
1 parent 182678d commit afb5041

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

descriptors/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![no_std]
2+
13
use bitfield::bitfield;
24

35
/// GlobalItemKind describes global item tags as described in section 6.2.2.7
@@ -68,9 +70,9 @@ impl From<MainItemKind> for u8 {
6870
}
6971
}
7072

71-
impl From<String> for MainItemKind {
72-
fn from(s: String) -> Self {
73-
match s.as_str() {
73+
impl From<&str> for MainItemKind {
74+
fn from(s: &str) -> Self {
75+
match s {
7476
"feature" => MainItemKind::Feature,
7577
"output" => MainItemKind::Output,
7678
"collection" => MainItemKind::Collection,

macros/src/spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ impl GroupSpec {
519519
fn from_field(&mut self, input: ParseStream, field: Expr) -> Result<()> {
520520
if let Some(i) = maybe_parse_kv(field.clone()) {
521521
let (name, item_kind, settings, bits, quirks) = i;
522-
self.set_item(name, item_kind.into(), settings, bits, quirks);
522+
self.set_item(name, item_kind.as_str().into(), settings, bits, quirks);
523523
return Ok(());
524524
};
525525
match parse_group_spec(input, field) {

0 commit comments

Comments
 (0)