mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +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 {
|
impl ShortLabel for ast::Const {
|
||||||
fn short_label(&self) -> Option<String> {
|
fn short_label(&self) -> Option<String> {
|
||||||
match short_label_from_ty(self, self.ty(), "const ") {
|
let mut new_buf = short_label_from_ty(self, self.ty(), "const ")?;
|
||||||
Some(buf) => {
|
if let Some(expr) = self.body() {
|
||||||
let mut new_buf = buf;
|
format_to!(new_buf, " = {}", expr.syntax());
|
||||||
let body = self.body().unwrap();
|
|
||||||
format_to!(new_buf, " = {}", body.syntax());
|
|
||||||
Some(new_buf)
|
|
||||||
}
|
|
||||||
None => None,
|
|
||||||
}
|
}
|
||||||
|
Some(new_buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue