We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d9c882 commit 958b91cCopy full SHA for 958b91c
crates/ra_ide/src/display/short_label.rs
@@ -61,15 +61,11 @@ impl ShortLabel for ast::TypeAlias {
61
62
impl ShortLabel for ast::Const {
63
fn short_label(&self) -> Option<String> {
64
- match short_label_from_ty(self, self.ty(), "const ") {
65
- Some(buf) => {
66
- let mut new_buf = buf;
67
- let body = self.body().unwrap();
68
- format_to!(new_buf, " = {}", body.syntax());
69
- Some(new_buf)
70
- }
71
- None => None,
+ let mut new_buf = short_label_from_ty(self, self.ty(), "const ")?;
+ if let Some(expr) = self.body() {
+ format_to!(new_buf, " = {}", expr.syntax());
72
}
+ Some(new_buf)
73
74
75
0 commit comments