diff options
author | Lukas Wirth <[email protected]> | 2021-03-09 15:33:41 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-03-09 16:18:50 +0000 |
commit | 814d617d348c23507fd444e58515c9bff6b73105 (patch) | |
tree | 5c722ffc17e90f76b2ea479ac2d67429380d7d04 /crates/hir | |
parent | 983726a45cf3daafbf4b245e220773bd12897bb7 (diff) |
Show whether a binding is mutable or not on hover
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/lib.rs | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index d5a3d9034..caf4c3395 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -1296,13 +1296,7 @@ impl Local { | |||
1296 | 1296 | ||
1297 | pub fn is_mut(self, db: &dyn HirDatabase) -> bool { | 1297 | pub fn is_mut(self, db: &dyn HirDatabase) -> bool { |
1298 | let body = db.body(self.parent.into()); | 1298 | let body = db.body(self.parent.into()); |
1299 | match &body[self.pat_id] { | 1299 | matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Mutable, .. }) |
1300 | Pat::Bind { mode, .. } => match mode { | ||
1301 | BindingAnnotation::Mutable | BindingAnnotation::RefMut => true, | ||
1302 | _ => false, | ||
1303 | }, | ||
1304 | _ => false, | ||
1305 | } | ||
1306 | } | 1300 | } |
1307 | 1301 | ||
1308 | pub fn parent(self, _db: &dyn HirDatabase) -> DefWithBody { | 1302 | pub fn parent(self, _db: &dyn HirDatabase) -> DefWithBody { |