Skip to main content

rustidy_ast/expr/without_block/
macro_invocation.rs

1//! Macro invocation
2
3// Imports
4use {
5	crate::{attr::DelimTokenTree, path::SimplePath, token},
6	rustidy_format::{Format, Formattable, WhitespaceFormat},
7	rustidy_parse::Parse,
8	rustidy_print::Print,
9	rustidy_util::Whitespace,
10};
11
12/// `MacroInvocation`
13#[derive(PartialEq, Eq, Clone, Debug)]
14#[derive(serde::Serialize, serde::Deserialize)]
15#[derive(Parse, Formattable, Format, Print)]
16#[parse(name = "a macro invocation")]
17pub struct MacroInvocation {
18	pub path: SimplePath,
19	#[format(prefix_ws = Whitespace::REMOVE)]
20	pub not:  token::Not,
21	#[format(prefix_ws = match self.tree {
22		DelimTokenTree::Braces(_) => Whitespace::SINGLE,
23		_ => Whitespace::REMOVE,
24	})]
25	pub tree: DelimTokenTree,
26}