Skip to content

Commit b3fa50d

Browse files
committed
Use nested_shape for indenting types of lazy_static
1 parent 6191902 commit b3fa50d

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ fn format_lazy_static(context: &RewriteContext, shape: Shape, ts: &TokenStream)
916916
"{}static ref {}: {} =",
917917
vis,
918918
id,
919-
ty.rewrite(context, shape)?
919+
ty.rewrite(context, nested_shape)?
920920
));
921921
result.push_str(&::expr::rewrite_assign_rhs(
922922
context,

tests/source/lazy_static.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ let ptr = :: remacs_sys :: xmalloc (
3535
remacs_sys :: Lisp_Subr ; :: std :: ptr :: copy_nonoverlapping (
3636
& subr , ptr , 1 ) ; :: std :: mem :: forget ( subr ) ; :: lisp :: ExternalPtr
3737
:: new ( ptr ) } } ; }
38+
39+
40+
lazy_static! {
41+
static ref FOO: HashMap<String,
42+
(&'static str,
43+
fn(Foo) -> Result<Box<Bar>, Either<FooError, BarError>>
44+
),> = HashMap::new();
45+
}

tests/target/lazy_static.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,13 @@ lazy_static! {
3737
}
3838
};
3939
}
40+
41+
lazy_static! {
42+
static ref FOO: HashMap<
43+
String,
44+
(
45+
&'static str,
46+
fn(Foo) -> Result<Box<Bar>, Either<FooError, BarError>>
47+
),
48+
> = HashMap::new();
49+
}

0 commit comments

Comments
 (0)