diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/codegen/mod.rs | 8 | ||||
-rw-r--r-- | src/options.rs | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 2522922a..b823fb34 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -2023,7 +2023,8 @@ impl CodeGenerator for CompInfo { attributes.push(attributes::derives(&derives)) } - if item.annotations().must_use_type() || ctx.must_use_type_by_name(item) { + if item.annotations().must_use_type() || ctx.must_use_type_by_name(item) + { attributes.push(attributes::must_use()); } @@ -3002,6 +3003,11 @@ impl CodeGenerator for Enum { attrs.push(attributes::doc(comment)); } + if item.annotations().must_use_type() || ctx.must_use_type_by_name(item) + { + attrs.push(attributes::must_use()); + } + if !variation.is_const() { let mut derives = derives_of_item(item, ctx); // For backwards compat, enums always derive Clone/Eq/PartialEq/Hash, even diff --git a/src/options.rs b/src/options.rs index 7f27e221..0524871a 100644 --- a/src/options.rs +++ b/src/options.rs @@ -949,7 +949,7 @@ where builder = builder.no_hash(regex); } } - + if let Some(must_use_type) = matches.values_of("must-use-type") { for regex in must_use_type { builder = builder.must_use_type(regex); |