mirror of
https://github.com/danog/strum.git
synced 2024-11-26 12:04:38 +01:00
Handle rustoc comments in #[derive(FromRepr)]
(#276)
This commit is contained in:
parent
0a0def76bd
commit
93ea44dd12
@ -16,7 +16,15 @@ pub fn from_repr_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
|
||||
for attr in attrs {
|
||||
let path = attr.path();
|
||||
|
||||
let mut ts = attr.meta.require_list()?.to_token_stream().into_iter();
|
||||
let mut ts = if let Ok(ts) = attr
|
||||
.meta
|
||||
.require_list()
|
||||
.map(|metas| metas.to_token_stream().into_iter())
|
||||
{
|
||||
ts
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
// Discard the path
|
||||
let _ = ts.next();
|
||||
let tokens: TokenStream = ts.collect();
|
||||
|
@ -1,6 +1,7 @@
|
||||
use strum::FromRepr;
|
||||
|
||||
#[derive(Debug, FromRepr, PartialEq)]
|
||||
/// Day of the week
|
||||
#[repr(u8)]
|
||||
enum Week {
|
||||
Sunday,
|
||||
|
Loading…
Reference in New Issue
Block a user