Skip to content

Commit e56a61f

Browse files
committed
u
1 parent 2b0f7b0 commit e56a61f

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/macros.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,11 @@ fn rewrite_macro_inner(
226226
};
227227
}
228228
// Format well-known macros which cannot be parsed as a valid AST.
229-
if (macro_name == "lazy_static!" || macro_name == "lazy_static::lazy_static!") && !has_comment {
229+
if (macro_name == "lazy_static!"
230+
|| (context.config.style_edition() >= StyleEdition::Edition2027
231+
&& macro_name == "lazy_static::lazy_static!"))
232+
&& !has_comment
233+
{
230234
match format_lazy_static(context, shape, ts.clone(), mac.span(), &macro_name) {
231235
Ok(rw) => return Ok(rw),
232236
Err(err) => match err {

tests/source/lazy_static.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// rustfmt-style_edition: 2027
12
// Format `lazy_static!` and `lazy_static::lazy_static!`.
23

34
lazy_static! {

tests/target/lazy_static.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// rustfmt-style_edition: 2027
12
// Format `lazy_static!` and `lazy_static::lazy_static!`.
23

34
lazy_static! {

0 commit comments

Comments
 (0)