mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
Merge pull request #2467 from topecongiro/issue-2466
Skip formatting macro_rules! that are not using {}
This commit is contained in:
commit
377bb5c97f
@ -294,6 +294,9 @@ pub fn rewrite_macro_def(
|
||||
span: Span,
|
||||
) -> Option<String> {
|
||||
let snippet = Some(remove_trailing_white_spaces(context.snippet(span)));
|
||||
if snippet.as_ref().map_or(true, |s| s.ends_with(";")) {
|
||||
return snippet;
|
||||
}
|
||||
|
||||
let mut parser = MacroParser::new(def.stream().into_trees());
|
||||
let parsed_def = match parser.parse() {
|
||||
|
@ -68,3 +68,12 @@ macro_rules! m {
|
||||
$line3_xxxxxxxxxxxxxxxxx: expr,
|
||||
) => {};
|
||||
}
|
||||
|
||||
// #2466
|
||||
// Skip formatting `macro_rules!` that are not using `{}`.
|
||||
macro_rules! m (
|
||||
() => ()
|
||||
);
|
||||
macro_rules! m [
|
||||
() => ()
|
||||
];
|
||||
|
@ -59,3 +59,12 @@ macro_rules! m {
|
||||
$line3_xxxxxxxxxxxxxxxxx: expr,
|
||||
) => {};
|
||||
}
|
||||
|
||||
// #2466
|
||||
// Skip formatting `macro_rules!` that are not using `{}`.
|
||||
macro_rules! m (
|
||||
() => ()
|
||||
);
|
||||
macro_rules! m [
|
||||
() => ()
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user