From ac678473b85da24fc15315054e9737347fadb55c Mon Sep 17 00:00:00 2001 From: kjeremy Date: Mon, 4 Mar 2019 09:52:48 -0500 Subject: Use impl_froms! --- crates/ra_hir/src/ty/infer.rs | 16 +++------------- 1 file 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 { #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] enum ExprOrPatId { - Expr(ExprId), - Pat(PatId), + ExprId(ExprId), + PatId(PatId), } -impl From for ExprOrPatId { - fn from(id: ExprId) -> Self { - ExprOrPatId::Expr(id) - } -} - -impl From for ExprOrPatId { - fn from(id: PatId) -> Self { - ExprOrPatId::Pat(id) - } -} +impl_froms!(ExprOrPatId: ExprId, PatId); /// The result of type inference: A mapping from expressions and patterns to types. #[derive(Clone, PartialEq, Eq, Debug)] -- cgit v1.2.3