aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2019-03-04 14:52:48 +0000
committerkjeremy <[email protected]>2019-03-04 14:52:48 +0000
commitac678473b85da24fc15315054e9737347fadb55c (patch)
treece8e8dfab834b7bbb7f1a073a045cafeedfe2d0d
parent1578375b89848b98a4d5187aaf794bc227d1eda6 (diff)
Use impl_froms!
-rw-r--r--crates/ra_hir/src/ty/infer.rs16
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)]
59enum ExprOrPatId { 59enum ExprOrPatId {
60 Expr(ExprId), 60 ExprId(ExprId),
61 Pat(PatId), 61 PatId(PatId),
62} 62}
63 63
64impl From<ExprId> for ExprOrPatId { 64impl_froms!(ExprOrPatId: ExprId, PatId);
65 fn from(id: ExprId) -> Self {
66 ExprOrPatId::Expr(id)
67 }
68}
69
70impl 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)]