use infallible for cleaner type checking, clean up comments

This commit is contained in:
gluaxspeed 2021-01-25 15:19:44 -05:00
parent 29ff3c90b6
commit fe4a101d8d

View File

@ -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) => {