about summary refs log tree commit diff
path: root/compiler/rustc_macros/src/extension.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_macros/src/extension.rs')
-rw-r--r--compiler/rustc_macros/src/extension.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_macros/src/extension.rs b/compiler/rustc_macros/src/extension.rs
index 7830137f218..5377bbdfeab 100644
--- a/compiler/rustc_macros/src/extension.rs
+++ b/compiler/rustc_macros/src/extension.rs
@@ -68,7 +68,14 @@ pub(crate) fn extension(
 
 /// Only keep `#[doc]` attrs.
 fn scrub_attrs(attrs: &[Attribute]) -> Vec<Attribute> {
-    attrs.into_iter().cloned().filter(|attr| attr.path().segments[0].ident == "doc").collect()
+    attrs
+        .into_iter()
+        .cloned()
+        .filter(|attr| {
+            let ident = &attr.path().segments[0].ident;
+            ident == "doc" || ident == "must_use"
+        })
+        .collect()
 }
 
 /// Scrub arguments so that they're valid for trait signatures.