summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
authorKarel Peeters <karel.peeters.leuven@gmail.com>2021-07-23 17:43:44 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2021-07-31 13:47:39 +0200
commit9833b6745d74896620ea760f3bf81f344a105f30 (patch)
tree98981ecc2b96d7fdafd8f737f460f3fc51214b19 /src/codegen/mod.rs
parentd1d2eb62d36c462416a606c680e6b4ba4716daab (diff)
Implement must_use_type commandline flag and builder option.
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 0f3337ac..76c64e4a 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -2023,6 +2023,10 @@ impl CodeGenerator for CompInfo {
attributes.push(attributes::derives(&derives))
}
+ if ctx.must_use_type_by_name(item) {
+ attributes.push(attributes::must_use());
+ }
+
let mut tokens = if is_union && struct_layout.is_rust_union() {
quote! {
#( #attributes )*