mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Use impl_froms!
This commit is contained in:
parent
1578375b89
commit
ac678473b8
@ -57,21 +57,11 @@ pub fn infer(db: &impl HirDatabase, func: Function) -> Arc<InferenceResult> {
|
|||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||||
enum ExprOrPatId {
|
enum ExprOrPatId {
|
||||||
Expr(ExprId),
|
ExprId(ExprId),
|
||||||
Pat(PatId),
|
PatId(PatId),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ExprId> for ExprOrPatId {
|
impl_froms!(ExprOrPatId: ExprId, PatId);
|
||||||
fn from(id: ExprId) -> Self {
|
|
||||||
ExprOrPatId::Expr(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<PatId> for ExprOrPatId {
|
|
||||||
fn from(id: PatId) -> Self {
|
|
||||||
ExprOrPatId::Pat(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The result of type inference: A mapping from expressions and patterns to types.
|
/// The result of type inference: A mapping from expressions and patterns to types.
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user