mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 13:05:18 +03:00
fix 'Ident of macro+ident gets duplicated' error
This commit is contained in:
+2
-1
@@ -432,7 +432,8 @@ pub fn rewrite_macro_inner(
|
||||
// the `macro_name!` and `{ /* macro_body */ }` but skip modifying
|
||||
// anything in between the braces (for now).
|
||||
let snippet = context.snippet(mac.span);
|
||||
let macro_raw = snippet.split_at(snippet.find('!')? + 1).1.trim_start();
|
||||
// to remove unnecessary space after macro name
|
||||
let macro_raw = snippet.trim_start_matches(¯o_name).trim_start();
|
||||
match trim_left_preserve_layout(macro_raw, shape.indent, &context.config) {
|
||||
Some(macro_body) => Some(format!("{} {}", macro_name, macro_body)),
|
||||
None => Some(format!("{} {}", macro_name, macro_raw)),
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
use repro::my_macro;
|
||||
|
||||
#[my_macro]
|
||||
xyz! abc {
|
||||
let a = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user