aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir/src/lib.rs')
-rw-r--r--crates/hir/src/lib.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 12dd5fb38..861b7329e 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -1335,7 +1335,7 @@ impl Local {
1335 1335
1336 // FIXME: why is this an option? It shouldn't be? 1336 // FIXME: why is this an option? It shouldn't be?
1337 pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { 1337 pub fn name(self, db: &dyn HirDatabase) -> Option<Name> {
1338 let body = db.body(self.parent.into()); 1338 let body = db.body(self.parent);
1339 match &body[self.pat_id] { 1339 match &body[self.pat_id] {
1340 Pat::Bind { name, .. } => Some(name.clone()), 1340 Pat::Bind { name, .. } => Some(name.clone()),
1341 _ => None, 1341 _ => None,
@@ -1347,7 +1347,7 @@ impl Local {
1347 } 1347 }
1348 1348
1349 pub fn is_mut(self, db: &dyn HirDatabase) -> bool { 1349 pub fn is_mut(self, db: &dyn HirDatabase) -> bool {
1350 let body = db.body(self.parent.into()); 1350 let body = db.body(self.parent);
1351 matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Mutable, .. }) 1351 matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Mutable, .. })
1352 } 1352 }
1353 1353
@@ -1360,7 +1360,7 @@ impl Local {
1360 } 1360 }
1361 1361
1362 pub fn ty(self, db: &dyn HirDatabase) -> Type { 1362 pub fn ty(self, db: &dyn HirDatabase) -> Type {
1363 let def = DefWithBodyId::from(self.parent); 1363 let def = self.parent;
1364 let infer = db.infer(def); 1364 let infer = db.infer(def);
1365 let ty = infer[self.pat_id].clone(); 1365 let ty = infer[self.pat_id].clone();
1366 let krate = def.module(db.upcast()).krate(); 1366 let krate = def.module(db.upcast()).krate();
@@ -1368,7 +1368,7 @@ impl Local {
1368 } 1368 }
1369 1369
1370 pub fn source(self, db: &dyn HirDatabase) -> InFile<Either<ast::IdentPat, ast::SelfParam>> { 1370 pub fn source(self, db: &dyn HirDatabase) -> InFile<Either<ast::IdentPat, ast::SelfParam>> {
1371 let (_body, source_map) = db.body_with_source_map(self.parent.into()); 1371 let (_body, source_map) = db.body_with_source_map(self.parent);
1372 let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm... 1372 let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm...
1373 let root = src.file_syntax(db.upcast()); 1373 let root = src.file_syntax(db.upcast());
1374 src.map(|ast| { 1374 src.map(|ast| {
@@ -1393,12 +1393,12 @@ impl Label {
1393 } 1393 }
1394 1394
1395 pub fn name(self, db: &dyn HirDatabase) -> Name { 1395 pub fn name(self, db: &dyn HirDatabase) -> Name {
1396 let body = db.body(self.parent.into()); 1396 let body = db.body(self.parent);
1397 body[self.label_id].name.clone() 1397 body[self.label_id].name.clone()
1398 } 1398 }
1399 1399
1400 pub fn source(self, db: &dyn HirDatabase) -> InFile<ast::Label> { 1400 pub fn source(self, db: &dyn HirDatabase) -> InFile<ast::Label> {
1401 let (_body, source_map) = db.body_with_source_map(self.parent.into()); 1401 let (_body, source_map) = db.body_with_source_map(self.parent);
1402 let src = source_map.label_syntax(self.label_id); 1402 let src = source_map.label_syntax(self.label_id);
1403 let root = src.file_syntax(db.upcast()); 1403 let root = src.file_syntax(db.upcast());
1404 src.map(|ast| ast.to_node(&root)) 1404 src.map(|ast| ast.to_node(&root))