Auto merge of #16824 - Wilfred:size_whitespace, r=lnicola

minor: Fix unwanted leading whitespace in hover text

PR #16366 moved layout information to a separate line, so the leading whitespace is no longer necessary.
This commit is contained in:
bors 2024-03-13 08:47:10 +00:00
commit e8182a5bb3
2 changed files with 65 additions and 65 deletions

View File

@ -510,7 +510,7 @@ fn render_notable_trait_comment(
let mut needs_impl_header = true; let mut needs_impl_header = true;
for (trait_, assoc_types) in notable_traits { for (trait_, assoc_types) in notable_traits {
desc.push_str(if mem::take(&mut needs_impl_header) { desc.push_str(if mem::take(&mut needs_impl_header) {
" // Implements notable traits: " "// Implements notable traits: "
} else { } else {
", " ", "
}); });
@ -661,7 +661,7 @@ fn closure_ty(
if let Some(layout) = if let Some(layout) =
render_memory_layout(config.memory_layout, || original.layout(sema.db), |_| None, |_| None) render_memory_layout(config.memory_layout, || original.layout(sema.db), |_| None, |_| None)
{ {
format_to!(markup, "{layout}"); format_to!(markup, " {layout}");
} }
if let Some(trait_) = c.fn_trait(sema.db).get_id(sema.db, original.krate(sema.db).into()) { if let Some(trait_) = c.fn_trait(sema.db).get_id(sema.db, original.krate(sema.db).into()) {
push_new_def(hir::Trait::from(trait_).into()) push_new_def(hir::Trait::from(trait_).into())
@ -730,7 +730,7 @@ fn render_memory_layout(
let config = config?; let config = config?;
let layout = layout().ok()?; let layout = layout().ok()?;
let mut label = String::from(" // "); let mut label = String::from("// ");
if let Some(render) = config.size { if let Some(render) = config.size {
let size = match tag(&layout) { let size = match tag(&layout) {