Skip to content

Commit

Permalink
Better codes
Browse files Browse the repository at this point in the history
Signed-off-by: JmPotato <[email protected]>
  • Loading branch information
JmPotato committed Aug 10, 2020
1 parent 4d9c882 commit 958b91c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions crates/ra_ide/src/display/short_label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,11 @@ impl ShortLabel for ast::TypeAlias {

impl ShortLabel for ast::Const {
fn short_label(&self) -> Option<String> {
match short_label_from_ty(self, self.ty(), "const ") {
Some(buf) => {
let mut new_buf = buf;
let body = self.body().unwrap();
format_to!(new_buf, " = {}", body.syntax());
Some(new_buf)
}
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());
}
Some(new_buf)
}
}

Expand Down

0 comments on commit 958b91c

Please sign in to comment.