Show whether a binding is mutable or not on hover

This commit is contained in:
Lukas Wirth 2021-03-09 16:33:41 +01:00
parent 983726a45c
commit 814d617d34
3 changed files with 47 additions and 28 deletions

View file

@ -1296,13 +1296,7 @@ impl Local {
pub fn is_mut(self, db: &dyn HirDatabase) -> bool {
let body = db.body(self.parent.into());
match &body[self.pat_id] {
Pat::Bind { mode, .. } => match mode {
BindingAnnotation::Mutable | BindingAnnotation::RefMut => true,
_ => false,
},
_ => false,
}
matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Mutable, .. })
}
pub fn parent(self, _db: &dyn HirDatabase) -> DefWithBody {