Remove path member from MatchError

At this point, this is too complicated to implement for me.
This commit is contained in:
Matthias Beyer 2015-10-30 17:46:25 +01:00
parent 10697feb8a
commit 9dde3e4f72

View file

@ -54,7 +54,6 @@ impl Display for FileHeaderSpec {
pub struct MatchError<'a> { pub struct MatchError<'a> {
summary: String, summary: String,
path: Vec<FileHeaderSpec>,
expected: &'a FileHeaderSpec, expected: &'a FileHeaderSpec,
found: &'a FileHeaderData found: &'a FileHeaderData
} }
@ -62,20 +61,18 @@ pub struct MatchError<'a> {
impl<'a> MatchError<'a> { impl<'a> MatchError<'a> {
pub fn new(s: String, pub fn new(s: String,
path: Vec<FileHeaderSpec>,
ex: &'a FileHeaderSpec, ex: &'a FileHeaderSpec,
found: &'a FileHeaderData) -> MatchError<'a> { found: &'a FileHeaderData) -> MatchError<'a> {
MatchError { MatchError {
summary: s, summary: s,
path: path,
expected: ex, expected: ex,
found: found, found: found,
} }
} }
pub fn format(&self) -> String { pub fn format(&self) -> String {
format!("MatchError: {:?}\n\nHaving: {:?}\nExpected: {:?}\nFound: {:?}\n", format!("MatchError: {:?}\nExpected: {:?}\nFound: {:?}\n",
self.summary, self.path, self.expected, self.found) self.summary, self.expected, self.found)
} }
} }
@ -144,7 +141,6 @@ pub fn match_header_spec<'a>(spec: &'a FileHeaderSpec, data: &'a FileHeaderData)
(k, v) => { (k, v) => {
return Some(MatchError::new(String::from("Expected type does not match found type"), return Some(MatchError::new(String::from("Expected type does not match found type"),
vec![],
k, v k, v
)) ))
} }