chore(tazjin/rlox): Add From<Error> for Vec<Error>

This makes it easier to transition between the single/multi error
functions via ?

Change-Id: Ie027f4700da463a549be6f0d4a0022a9b8dc0d61
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2555
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
Vincent Ambo 2021-02-27 14:17:18 +02:00 committed by tazjin
parent 75750ba683
commit da2dfb42c6

View file

@ -37,4 +37,12 @@ impl From<ScannerError> for Error {
}
}
// Convenience implementation as we're often dealing with vectors of
// errors (to report as many issues as possible before terminating)
impl From<Error> for Vec<Error> {
fn from(err: Error) -> Self {
vec![err]
}
}
pub type LoxResult<T> = Result<T, Error>;