Skip to content

Instantly share code, notes, and snippets.

@phansch
Created October 11, 2019 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phansch/b7e42d3bba55def4268abd972201b2f2 to your computer and use it in GitHub Desktop.
Save phansch/b7e42d3bba55def4268abd972201b2f2 to your computer and use it in GitHub Desktop.
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