Skip to content

Commit fff6c51

Browse files
rscprofytmimi
authored andcommitted
Update src/macros.rs
Co-authored-by: Yacin Tmimi <yacintmimi@gmail.com>
1 parent c23edcc commit fff6c51

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/macros.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ fn rewrite_macro_inner(
216216
let ts = mac.args.tokens.clone();
217217
let has_comment = contains_comment(context.snippet(mac.span()));
218218
if ts.is_empty() && !has_comment {
219-
return (
220-
match style {
219+
let rewrite = match style {
221220
Delimiter::Parenthesis if position == MacroPosition::Item => {
222221
Some(format!("{macro_name}();"))
223222
}
@@ -228,13 +227,8 @@ fn rewrite_macro_inner(
228227
Delimiter::Bracket => Some(format!("{macro_name}[]")),
229228
Delimiter::Brace => Some(format!("{macro_name} {{}}")),
230229
_ => unreachable!(),
231-
},
232-
if original_style != style {
233-
Some(style)
234-
} else {
235-
None
236-
},
237-
);
230+
};
231+
return (rewrite, Some(style));
238232
}
239233
// Format well-known macros which cannot be parsed as a valid AST.
240234
if macro_name == "lazy_static!" && !has_comment {

0 commit comments

Comments
 (0)