mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Better codes
Signed-off-by: JmPotato <ghzpotato@gmail.com>
This commit is contained in:
parent
4d9c8821e5
commit
958b91c1e8
1 changed files with 4 additions and 8 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue