Skip to content

Commit 99e1cdb

Browse files
committed
rustdoc: get rid of redundant, nested let lines
1 parent e26ae95 commit 99e1cdb

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

src/librustdoc/html/render/print_item.rs

+13-17
Original file line numberDiff line numberDiff line change
@@ -1956,11 +1956,12 @@ fn document_type_layout<'a, 'cx: 'a>(
19561956
return Ok(());
19571957
}
19581958

1959-
let variants = {
1960-
let tcx = cx.tcx();
1961-
let param_env = tcx.param_env(ty_def_id);
1962-
let ty = tcx.type_of(ty_def_id).subst_identity();
1963-
let type_layout = tcx.layout_of(param_env.and(ty));
1959+
let tcx = cx.tcx();
1960+
let param_env = tcx.param_env(ty_def_id);
1961+
let ty = tcx.type_of(ty_def_id).subst_identity();
1962+
let type_layout = tcx.layout_of(param_env.and(ty));
1963+
1964+
let variants =
19641965
if let Ok(type_layout) = type_layout &&
19651966
let Variants::Multiple { variants, tag, tag_encoding, .. } =
19661967
type_layout.layout.variants() &&
@@ -1991,19 +1992,14 @@ fn document_type_layout<'a, 'cx: 'a>(
19911992
} else {
19921993
Vec::new()
19931994
}
1994-
};
1995+
;
19951996

1996-
let type_layout_size = {
1997-
let tcx = cx.tcx();
1998-
let param_env = tcx.param_env(ty_def_id);
1999-
let ty = tcx.type_of(ty_def_id).subst_identity();
2000-
tcx.layout_of(param_env.and(ty)).map(|layout| {
2001-
let is_unsized = layout.abi.is_unsized();
2002-
let is_uninhabited = layout.abi.is_uninhabited();
2003-
let size = layout.size.bytes();
2004-
TypeLayoutSize { is_unsized, is_uninhabited, size }
2005-
})
2006-
};
1997+
let type_layout_size = tcx.layout_of(param_env.and(ty)).map(|layout| {
1998+
let is_unsized = layout.abi.is_unsized();
1999+
let is_uninhabited = layout.abi.is_uninhabited();
2000+
let size = layout.size.bytes();
2001+
TypeLayoutSize { is_unsized, is_uninhabited, size }
2002+
});
20072003

20082004
Ok(TypeLayout { variants, type_layout_size }.render_into(f).unwrap())
20092005
})

0 commit comments

Comments
 (0)