diff options
author | Aleksey Kladov <[email protected]> | 2021-06-14 20:42:43 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-06-14 20:42:43 +0100 |
commit | c2015e7d182f3cb2cebe686127dd6a3e683df9e6 (patch) | |
tree | eb46a7d8ad5f0549fd79a51268d79859a1cb6c2d /crates/hir | |
parent | 4cfc767d7fadeab025227d67f104065c9e8a55d3 (diff) |
internal: more natural order of sources for TypeParam
We usually use first (left) variant of `Either` for "usual" case, and
use right for odd things. For example, pat source is Pat | SelfParam.
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/has_source.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs index dc10a4d0f..197149c5e 100644 --- a/crates/hir/src/has_source.rs +++ b/crates/hir/src/has_source.rs | |||
@@ -127,7 +127,7 @@ impl HasSource for Impl { | |||
127 | } | 127 | } |
128 | 128 | ||
129 | impl HasSource for TypeParam { | 129 | impl HasSource for TypeParam { |
130 | type Ast = Either<ast::Trait, ast::TypeParam>; | 130 | type Ast = Either<ast::TypeParam, ast::Trait>; |
131 | fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> { | 131 | fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> { |
132 | let child_source = self.id.parent.child_source(db.upcast()); | 132 | let child_source = self.id.parent.child_source(db.upcast()); |
133 | Some(child_source.map(|it| it[self.id.local_id].clone())) | 133 | Some(child_source.map(|it| it[self.id.local_id].clone())) |