mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
macro-generate froms
This commit is contained in:
parent
aea1f95a66
commit
a7c0336a75
4 changed files with 17 additions and 78 deletions
|
@ -5,6 +5,18 @@
|
|||
//! to a particular crate instance. That is, it has cfg flags and features
|
||||
//! applied. So, the relation between syntax and HIR is many-to-one.
|
||||
|
||||
macro_rules! impl_froms {
|
||||
($e:ident: $($v:ident), *) => {
|
||||
$(
|
||||
impl From<$v> for $e {
|
||||
fn from(it: $v) -> $e {
|
||||
$e::$v(it)
|
||||
}
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
pub mod db;
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue