Skip to content

Instantly share code, notes, and snippets.

@phansch

phansch/macros.patch

Created Oct 11, 2019
Embed
What would you like to do?
diff --git a/tests/ui/auxiliary/macro_rules.rs b/tests/ui/auxiliary/macro_rules.rs
index 486e419b..2d8d571d 100644
--- a/tests/ui/auxiliary/macro_rules.rs
+++ b/tests/ui/auxiliary/macro_rules.rs
@@ -7,3 +7,9 @@ macro_rules! foofoo {
loop {}
};
}
+
+macro_rules! must_use_unit {
+ () => {
+ fn foo() {}
+ }
+}
diff --git a/tests/ui/must_use_unit.rs b/tests/ui/must_use_unit.rs
index 8ea893d9..90af7f28 100644
--- a/tests/ui/must_use_unit.rs
+++ b/tests/ui/must_use_unit.rs
@@ -1,8 +1,12 @@
//run-rustfix
+// aux-build:macro_rules.rs
#![warn(clippy::must_use_unit)]
#![allow(clippy::unused_unit)]
+#[macro_use]
+extern crate macro_rules;
+
#[must_use]
pub fn must_use_default() {}
@@ -16,4 +20,7 @@ fn main() {
must_use_default();
must_use_unit();
must_use_with_note();
+
+ // We should not lint in external macros
+ must_use_unit!()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment