Skip to content

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Mar 5, 2024

#15938 (minor turned major wrt diff because of test changes)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 5, 2024
Comment on lines +599 to +623
if let Some(limit) = f.entity_limit {
let assoc_items = self.items(f.db);
let count = assoc_items.len().min(limit);
if count == 0 {
if assoc_items.is_empty() {
f.write_str(" {}")?;
} else {
f.write_str(" { /* … */ }")?;
}
} else {
f.write_str(" {\n")?;
for item in &assoc_items[..count] {
f.write_str(" ")?;
match item {
AssocItem::Function(func) => func.hir_fmt(f),
AssocItem::Const(cst) => cst.hir_fmt(f),
AssocItem::TypeAlias(type_alias) => type_alias.hir_fmt(f),
}?;
f.write_str(";\n")?;
}

if assoc_items.len() > count {
f.write_str(" /* … */\n")?;
}
f.write_str("}")?;
Copy link
Member Author

@Veykril Veykril Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Young-Flash sorry for changing stuff myself here (but I figured this wasn't worth going through additional review rounds given how long the PR has been up). I hope that's okays with you.

Made some small stylistic changes (; instead of , for seperators, given items), and more importantly if no limit is set we don't show any items or braces at all. As before this we'd still see {\n ...\n} for every trait hover which is rather noisy. If someone wants that they can set the limit to 0 instead of null.

@Veykril
Copy link
Member Author

Veykril commented Mar 5, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Mar 5, 2024

📌 Commit b20e467 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Mar 5, 2024

⌛ Testing commit b20e467 with merge 124d5ff...

@bors
Copy link
Contributor

bors commented Mar 5, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 124d5ff to master...

@bors bors merged commit 124d5ff into rust-lang:master Mar 5, 2024
@Veykril Veykril deleted the hover-trait branch March 5, 2024 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants