use std::fmt;

#[derive(Debug)]
pub enum ErrorLevel {
    Info,
    Warning,
    Error,
}

// Use a hashmap which contains an error level and a string
pub struct ErrorStack(Vec<(ErrorLevel, &'static str)>);

impl fmt::Display for ErrorStack {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        self.0
            .iter()
            .map(|e| write!(f, "[{:?}] {}\n", e.0, e.1))

            // We must consume the closure
            .collect::<Vec<fmt::Result>>();

        write!(f, "")
    }
}
#[derive(Debug)]
pub enum ErrorLevel {
    Info,
    Warning,
    Error,
}

// Use a hashmap which contains an error level and a string
pub type ErrorStack = Vec<(ErrorLevel, &'static str)>;

--- 
+++ 
@@ -1,5 +1,3 @@
-use std::fmt;
-
 #[derive(Debug)]
 pub enum ErrorLevel {
     Info,
@@ -8,17 +6,4 @@
 }
 
 // Use a hashmap which contains an error level and a string
-pub struct ErrorStack(Vec<(ErrorLevel, &'static str)>);
-
-impl fmt::Display for ErrorStack {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.0
-            .iter()
-            .map(|e| write!(f, "[{:?}] {}\n", e.0, e.1))
-
-            // We must consume the closure
-            .collect::<Vec<fmt::Result>>();
-
-        write!(f, "")
-    }
-}
+pub type ErrorStack = Vec<(ErrorLevel, &'static str)>;
Add display to the error stack and convert the type alias to a struct.
