Skip to content

Commit a9f8ea0

Browse files
committed
Simplify search for packed repr attr
1 parent 04faac9 commit a9f8ea0

3 files changed

Lines changed: 7 additions & 14 deletions

File tree

‎serde_derive/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ proc-macro = true
2222
[dependencies]
2323
proc-macro2 = "1.0"
2424
quote = "1.0"
25-
syn = { version = "1.0", features = ["visit"] }
25+
syn = { version = "1.0.33", features = ["visit"] }
2626

2727
[dev-dependencies]
2828
serde = { version = "1.0", path = "../serde" }

‎serde_derive/src/internals/attr.rs‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -597,19 +597,12 @@ impl Container {
597597
for attr in &item.attrs {
598598
if attr.path.is_ident("repr") {
599599
let _ = attr.parse_args_with(|input: ParseStream| {
600-
input.step(|cursor| {
601-
let mut rest = *cursor;
602-
while let Some((tt, next)) = rest.token_tree() {
603-
match &tt {
604-
TokenTree::Ident(ident) if ident == "packed" => {
605-
is_packed |= true;
606-
return Ok(((), next));
607-
}
608-
_ => rest = next,
609-
}
600+
while let Some(token) = input.parse()? {
601+
if let TokenTree::Ident(ident) = token {
602+
is_packed |= ident == "packed";
610603
}
611-
Err(cursor.error("no `packed` was found in the reprs"))
612-
})
604+
}
605+
Ok(())
613606
});
614607
}
615608
}

‎serde_derive_internals/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ path = "lib.rs"
1616
[dependencies]
1717
proc-macro2 = "1.0"
1818
quote = "1.0"
19-
syn = { version = "1.0", default-features = false, features = ["derive", "parsing", "printing", "clone-impls"] }
19+
syn = { version = "1.0.33", default-features = false, features = ["derive", "parsing", "printing", "clone-impls"] }
2020

2121
[package.metadata.docs.rs]
2222
targets = ["x86_64-unknown-linux-gnu"]

0 commit comments

Comments
 (0)