From bcbc72767288ac2723213d0b02dfe1f98cc27948 Mon Sep 17 00:00:00 2001 From: Camelid Date: Fri, 23 Apr 2021 14:01:00 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Ivan Tham --- src/librustdoc/html/render/print_item.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index a2d1a6a23c6..af7745d6126 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -1550,7 +1550,7 @@ fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) { writeln!( w, "

Note: Most layout information is \ - completely unstable and may be different between compiler versions. \ + completely unstable and may be different between compiler versions and platforms. \ The only exception is types with certain repr(...) attributes. \ Please see the Rust Reference’s \ “Type Layout” \ @@ -1559,11 +1559,12 @@ fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) { if ty_layout.layout.abi.is_unsized() { writeln!(w, "

Size: (unsized)

"); } else { + let bytes = ty_layout.layout.size.bytes(); writeln!( w, "

Size: {size} byte{pl}

", - size = ty_layout.layout.size.bytes(), - pl = if ty_layout.layout.size.bytes() == 1 { "" } else { "s" }, + size = bytes, + pl = if bytes == 1 { "" } else { "s" }, ); } writeln!(w, "
");