mirror of
https://github.com/dtolnay/thiserror.git
synced 2025-04-05 13:57:38 +03:00
Allow error(transparent) inside an enum that has error("...")
This commit is contained in:
parent
71adf02435
commit
65f1990265
1 changed files with 3 additions and 4 deletions
|
@ -91,14 +91,13 @@ impl<'a> Enum<'a> {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|node| {
|
.map(|node| {
|
||||||
let mut variant = Variant::from_syn(node, &scope)?;
|
let mut variant = Variant::from_syn(node, &scope)?;
|
||||||
if let display @ None = &mut variant.attrs.display {
|
if variant.attrs.display.is_none() && variant.attrs.transparent.is_none() {
|
||||||
display.clone_from(&attrs.display);
|
variant.attrs.display.clone_from(&attrs.display);
|
||||||
|
variant.attrs.transparent = attrs.transparent;
|
||||||
}
|
}
|
||||||
if let Some(display) = &mut variant.attrs.display {
|
if let Some(display) = &mut variant.attrs.display {
|
||||||
let container = ContainerKind::from_variant(node);
|
let container = ContainerKind::from_variant(node);
|
||||||
display.expand_shorthand(&variant.fields, container)?;
|
display.expand_shorthand(&variant.fields, container)?;
|
||||||
} else if variant.attrs.transparent.is_none() {
|
|
||||||
variant.attrs.transparent = attrs.transparent;
|
|
||||||
}
|
}
|
||||||
Ok(variant)
|
Ok(variant)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue