7942: Show whether a binding is mutable or not on hover r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2021-03-09 16:23:51 +00:00 committed by GitHub
commit c45ac6effe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 33 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 {