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 {
        for error in &self.0 {
            write!(f, "[{:?}] {}\n", error.0, error.1).unwrap();
        }

        write!(f, "")
    }
}

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, "")
    }
}
--- 
+++ 
@@ -12,9 +12,12 @@
 
 impl fmt::Display for ErrorStack {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        for error in &self.0 {
-            write!(f, "[{:?}] {}\n", error.0, error.1).unwrap();
-        }
+        self.0
+            .iter()
+            .map(|e| write!(f, "[{:?}] {}\n", e.0, e.1))
+
+            // We must consume the closure
+            .collect::<Vec<fmt::Result>>();
 
         write!(f, "")
     }
Move to a for-loop instead
