From: Ian Jackson Date: Sun, 23 Aug 2020 21:46:28 +0000 (+0100) Subject: for revert - error_display - can just use {:?} X-Git-Tag: otter-0.2.0~1063 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=75d063d87f67c161ad5fcbf9eb5955dfed0d1611;p=otter.git for revert - error_display - can just use {:?} --- diff --git a/src/lib.rs b/src/lib.rs index f1d151b3..dc7e63c4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ #![feature(proc_macro_hygiene, decl_macro)] #![feature(slice_strip)] +#![feature(error_iter)] #![allow(clippy::redundant_closure_call)] diff --git a/src/utils.rs b/src/utils.rs index 55117cb8..878d5d0a 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -6,3 +6,9 @@ pub trait OrdExt : Ord + Sized { } impl OrdExt for T where T : Ord + Sized { } + +pub fn error_display>(err: &E) { + for (e,i) in err.as_ref().chain().zip(0..) { + eprintln!("error {:2}: {}", i,e); + } +}