Macro warning

Source
macro_rules! warning {
    (
        $span:expr,
        $fmt:literal $(, $arg:expr)*
        $(; label_message: $label_message:literal $(, $label_message_arg:expr)*)?
        $(; label: $label:expr)*
        $(; note: $note:literal $(, $note_arg:expr)*)*
        $(; hint: $hint:literal $(, $hint_arg:expr)*)*
        $(; code: $code:expr)?
        $(,)?
        $(;)?
    ) => { ... };
}
Expand description

Construct a SourceDiagnostic with severity Warning.

You can also emit hints with the ; hint: "..." syntax.

warning!(span, "warning with a {}", "source result");
warning!(
    span, "warning with a {}", "source result";
    hint: "hint 1"
);
warning!(
    span, "warning with a {}", "source result";
    hint: "hint 1";
    hint: "hint 2";
);