ExprKind::Tup(_elems) => { None }
ExprKind in rustc_hir
Call(&'hir Expr<'hir>, &'hir [Expr<'hir>])
A function call.
The first field resolves to the function itself (usually an ExprKind::Path), and the second field is the list of arguments. This also represents calling the constructor of tuple-like ADTs such as tuple structs and enum variants.
看起来你的匹配表达式需要返回一个 Option
类型,但是你的当前实现返回的是 ()
类型(Rust的空类型)。你需要返回一个合适的 Option
类型,例如 None
或者 Some(T)
,其中 T
是一个适合你程序的类型。
如果你没有合适的值要返回,你可以简单地返回 None
,例如:
ExprKind::Tup(_elems) => {
// Do nothing for tuples, return None
None
}