Skip to content

Commit b9843d1

Browse files
authored
Merge pull request rust-lang#2515 from sinkuu/nested_shape_lazy_static
Use nested_shape for indenting types of lazy_static
2 parents 6191902 + b3fa50d commit b9843d1

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/macros.rs

+1-1
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

+8
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

+10
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)