diff --git a/crates/ra_ide_api/src/display/short_label.rs b/crates/ra_ide_api/src/display/short_label.rs index 6acb2ab925..ab67cc90ce 100644 --- a/crates/ra_ide_api/src/display/short_label.rs +++ b/crates/ra_ide_api/src/display/short_label.rs @@ -70,23 +70,23 @@ fn short_label_from_ascribed_node(node: &T, prefix: &str) -> Option where T: NameOwner + VisibilityOwner + TypeAscriptionOwner, { - let mut string = short_label_from_node(node, prefix)?; + let mut buf = short_label_from_node(node, prefix)?; if let Some(type_ref) = node.ascribed_type() { - string.push_str(": "); - type_ref.syntax().text().push_to(&mut string); + buf.push_str(": "); + type_ref.syntax().text().push_to(&mut buf); } - Some(string) + Some(buf) } fn short_label_from_node(node: &T, label: &str) -> Option where T: NameOwner + VisibilityOwner, { - let mut string = + let mut buf = node.visibility().map(|v| format!("{} ", v.syntax().text())).unwrap_or_default(); - string.push_str(label); - string.push_str(node.name()?.text().as_str()); - Some(string) + buf.push_str(label); + buf.push_str(node.name()?.text().as_str()); + Some(buf) }