mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-18 15:31:32 +03:00
use infallible for cleaner type checking, clean up comments
This commit is contained in:
parent
29ff3c90b6
commit
fe4a101d8d
@ -57,7 +57,8 @@ impl<'ast> Program {
|
|||||||
.definitions
|
.definitions
|
||||||
.to_owned()
|
.to_owned()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.find_map::<Result<(), _>, _>(|definition| match definition {
|
// Use of Infallible to say we never expect an Some(Ok(...))
|
||||||
|
.find_map::<Result<std::convert::Infallible, _>, _>(|definition| match definition {
|
||||||
Definition::Import(import) => {
|
Definition::Import(import) => {
|
||||||
imports.push(ImportStatement::from(import));
|
imports.push(ImportStatement::from(import));
|
||||||
None
|
None
|
||||||
@ -75,12 +76,6 @@ impl<'ast> Program {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
Definition::Deprecated(deprecated) => {
|
Definition::Deprecated(deprecated) => {
|
||||||
// 1. convert pest span to ast span.
|
|
||||||
// ast source common span
|
|
||||||
// new from span -> don't call direcrtly
|
|
||||||
|
|
||||||
// create separate file for error warnings
|
|
||||||
// "\"test function\" is deprecated. Did you mean @test?"
|
|
||||||
Some(Err(DeprecatedError::from(deprecated)))
|
Some(Err(DeprecatedError::from(deprecated)))
|
||||||
}
|
}
|
||||||
Definition::Annotated(annotated_definition) => {
|
Definition::Annotated(annotated_definition) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user