This code:
#[allow(dead_code)]
macro_rules! test {
($x:expr) => {{}}
}
fn main() {
println!("Results:")
}
produces the following warning about unused macro definition:
warning: unused macro definition
--> /home/xxx/.emacs.d/rust-playground/at-2017-08-02-031315/snippet.rs:10:1
|
10 | / macro_rules! test {
11 | | ($x:expr) => {{}}
12 | | }
| |_^
|
= note: #[warn(unused_macros)] on by default
Is it possible to suppress it? As you can see #[allow(dead_code)
doesn't help in case of macros.
If the source of the file is unknown and you don't want to enable macros, you can click the 'X' button to close the security warning. The warning will disappear, but macros will remain disabled. Any attempt to run a macro will result in the following message.
How to disable macros in Excel 1 In your Excel, click the File tab > Options. 2 On the left-side pane, select Trust Center, and then click Trust Center Settings… . 3 In the left menu, select Macro Settings, choose Disable all macros without notification, and click OK. More ...
Because macro security is critical for the security of Excel, Microsoft designed any VBA code to only be triggered by a user click. However, when Microsoft closes a door, the user opens a window :) As a workaround, someone suggested a way to force the user to enable macros with a kind of "splash screen" or "instruction sheet".
The following instructions will guide you through the steps to enable macros for the duration that the file is open: 1 Click the File tab > Info. 2 In the Security Warning area, click Enable Content > Advanced Options. 3 In the Microsoft Office Security Options dialog box, select Enable content for this session, and click OK.
The compiler warning states:
= note: #[warn(unused_macros)] on by default
Which is very similar to the warning caused by unused functions:
= note: #[warn(dead_code)] on by default
You can disable these warnings in the same way, but you need to use the matching macro attribute:
#[allow(unused_macros)]
macro_rules! test {
($x:expr) => {{}}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With