diff --git a/src/macros.rs b/src/macros.rs index e7238a314fc..6be6a1f2664 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -916,7 +916,7 @@ fn format_lazy_static(context: &RewriteContext, shape: Shape, ts: &TokenStream) "{}static ref {}: {} =", vis, id, - ty.rewrite(context, shape)? + ty.rewrite(context, nested_shape)? )); result.push_str(&::expr::rewrite_assign_rhs( context, diff --git a/tests/source/lazy_static.rs b/tests/source/lazy_static.rs index c1c74fb8307..38fefbcbef5 100644 --- a/tests/source/lazy_static.rs +++ b/tests/source/lazy_static.rs @@ -35,3 +35,11 @@ let ptr = :: remacs_sys :: xmalloc ( remacs_sys :: Lisp_Subr ; :: std :: ptr :: copy_nonoverlapping ( & subr , ptr , 1 ) ; :: std :: mem :: forget ( subr ) ; :: lisp :: ExternalPtr :: new ( ptr ) } } ; } + + +lazy_static! { +static ref FOO: HashMap Result, Either> +),> = HashMap::new(); +} diff --git a/tests/target/lazy_static.rs b/tests/target/lazy_static.rs index edce6e7b894..0aed6d38ccf 100644 --- a/tests/target/lazy_static.rs +++ b/tests/target/lazy_static.rs @@ -37,3 +37,13 @@ lazy_static! { } }; } + +lazy_static! { + static ref FOO: HashMap< + String, + ( + &'static str, + fn(Foo) -> Result, Either> + ), + > = HashMap::new(); +}