From da2dfb42c6c1cb3a63686be06e9ff04f445506b2 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 27 Feb 2021 14:17:18 +0200 Subject: chore(tazjin/rlox): Add From for Vec 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 --- users/tazjin/rlox/src/bytecode/errors.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'users/tazjin/rlox/src') diff --git a/users/tazjin/rlox/src/bytecode/errors.rs b/users/tazjin/rlox/src/bytecode/errors.rs index 513708df7e85..99b2aa406c99 100644 --- a/users/tazjin/rlox/src/bytecode/errors.rs +++ b/users/tazjin/rlox/src/bytecode/errors.rs @@ -37,4 +37,12 @@ impl From for Error { } } +// Convenience implementation as we're often dealing with vectors of +// errors (to report as many issues as possible before terminating) +impl From for Vec { + fn from(err: Error) -> Self { + vec![err] + } +} + pub type LoxResult = Result; -- cgit 1.4.1