2 #![warn(clippy::crate_in_macro_def)]
6 macro_rules! print_message_hygienic {
8 println!("{}", $crate::hygienic::MESSAGE);
12 pub const MESSAGE: &str = "Hello!";
17 macro_rules! print_message_unhygienic {
19 println!("{}", crate::unhygienic::MESSAGE);
23 pub const MESSAGE: &str = "Hello!";
26 mod unhygienic_intentionally {
27 // For cases where the use of `crate` is intentional, applying `allow` to the macro definition
28 // should suppress the lint.
29 #[allow(clippy::crate_in_macro_def)]
31 macro_rules! print_message_unhygienic_intentionally {
33 println!("{}", crate::CALLER_PROVIDED_MESSAGE);
40 macro_rules! print_message_not_exported {
42 println!("{}", crate::not_exported::MESSAGE);
46 pub const MESSAGE: &str = "Hello!";
50 print_message_hygienic!();
51 print_message_unhygienic!();
52 print_message_unhygienic_intentionally!();
53 print_message_not_exported!();
56 pub const CALLER_PROVIDED_MESSAGE: &str = "Hello!";