diff options
author | Aleksey Kladov <[email protected]> | 2019-01-24 16:12:11 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-24 16:16:25 +0000 |
commit | a7c0336a7516e4973a9efb86bfb97cf290441413 (patch) | |
tree | 8f442637075b9ba72ffe26b9e5426a0faab45e36 /crates/ra_hir/src/lib.rs | |
parent | aea1f95a665b56da5953907a122475db0c9a9c44 (diff) |
macro-generate froms
Diffstat (limited to 'crates/ra_hir/src/lib.rs')
-rw-r--r-- | crates/ra_hir/src/lib.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 5d6371892..33438509c 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -5,6 +5,18 @@ | |||
5 | //! to a particular crate instance. That is, it has cfg flags and features | 5 | //! to a particular crate instance. That is, it has cfg flags and features |
6 | //! applied. So, the relation between syntax and HIR is many-to-one. | 6 | //! applied. So, the relation between syntax and HIR is many-to-one. |
7 | 7 | ||
8 | macro_rules! impl_froms { | ||
9 | ($e:ident: $($v:ident), *) => { | ||
10 | $( | ||
11 | impl From<$v> for $e { | ||
12 | fn from(it: $v) -> $e { | ||
13 | $e::$v(it) | ||
14 | } | ||
15 | } | ||
16 | )* | ||
17 | } | ||
18 | } | ||
19 | |||
8 | pub mod db; | 20 | pub mod db; |
9 | #[cfg(test)] | 21 | #[cfg(test)] |
10 | mod mock; | 22 | mod mock; |