diff options
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r-- | src/codegen/mod.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 34b5b4d9..073745b1 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -2154,9 +2154,13 @@ impl MethodCodegen for Method { let mut attrs = vec![]; attrs.push(attributes::inline()); + if signature.must_use() && ctx.options().rust_features().must_use_function { + attrs.push(attributes::must_use()); + } + let name = ctx.rust_ident(&name); methods.push(quote! { - #[inline] + #(#attrs)* pub unsafe fn #name ( #( #args ),* ) #ret { #block } @@ -3374,6 +3378,10 @@ impl CodeGenerator for Function { let mut attributes = vec![]; + if signature.must_use() && ctx.options().rust_features().must_use_function { + attributes.push(attributes::must_use()); + } + if let Some(comment) = item.comment(ctx) { attributes.push(attributes::doc(comment)); } |