diff options
author | kjeremy <[email protected]> | 2019-03-04 14:52:48 +0000 |
---|---|---|
committer | kjeremy <[email protected]> | 2019-03-04 14:52:48 +0000 |
commit | ac678473b85da24fc15315054e9737347fadb55c (patch) | |
tree | ce8e8dfab834b7bbb7f1a073a045cafeedfe2d0d | |
parent | 1578375b89848b98a4d5187aaf794bc227d1eda6 (diff) |
Use impl_froms!
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 40559c3de..268d2c110 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -57,21 +57,11 @@ pub fn infer(db: &impl HirDatabase, func: Function) -> Arc<InferenceResult> { | |||
57 | 57 | ||
58 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] | 58 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] |
59 | enum ExprOrPatId { | 59 | enum ExprOrPatId { |
60 | Expr(ExprId), | 60 | ExprId(ExprId), |
61 | Pat(PatId), | 61 | PatId(PatId), |
62 | } | 62 | } |
63 | 63 | ||
64 | impl From<ExprId> for ExprOrPatId { | 64 | impl_froms!(ExprOrPatId: ExprId, PatId); |
65 | fn from(id: ExprId) -> Self { | ||
66 | ExprOrPatId::Expr(id) | ||
67 | } | ||
68 | } | ||
69 | |||
70 | impl From<PatId> for ExprOrPatId { | ||
71 | fn from(id: PatId) -> Self { | ||
72 | ExprOrPatId::Pat(id) | ||
73 | } | ||
74 | } | ||
75 | 65 | ||
76 | /// The result of type inference: A mapping from expressions and patterns to types. | 66 | /// The result of type inference: A mapping from expressions and patterns to types. |
77 | #[derive(Clone, PartialEq, Eq, Debug)] | 67 | #[derive(Clone, PartialEq, Eq, Debug)] |