mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-22 20:53:37 +00:00
fix 'Ident of macro+ident gets duplicated' error
This commit is contained in:
parent
06fc39f905
commit
40ff078abf
@ -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)),
|
||||
|
6
tests/target/issue-3439.rs
Normal file
6
tests/target/issue-3439.rs
Normal file
@ -0,0 +1,6 @@
|
||||
use repro::my_macro;
|
||||
|
||||
#[my_macro]
|
||||
xyz! abc {
|
||||
let a = 1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user