diff --git a/src/lib.rs b/src/lib.rs index 7d8a774..00b4ea1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -774,13 +774,15 @@ impl<'a> Display for Error<'a> { if circle.len() == 2 { try!(write!(f, "recipe `{}` depends on itself", recipe)); } else { - try!(write!(f, "recipe `{}` has circular dependency `{}`", recipe, circle.join(" -> "))); + try!(writeln!(f, "recipe `{}` has circular dependency `{}`", recipe, circle.join(" -> "))); } - return Ok(()); } ErrorKind::CircularVariableDependency{variable, ref circle} => { - try!(write!(f, "assignment to `{}` has circular dependency: `{}`", variable, circle.join(" -> "))); - return Ok(()); + if circle.len() == 2 { + try!(writeln!(f, "variable `{}` depends on its own value: `{}`", variable, circle.join(" -> "))); + } else { + try!(writeln!(f, "variable `{}` depends on its own value: `{}`", variable, circle.join(" -> "))); + } } ErrorKind::InvalidEscapeSequence{character} => { try!(writeln!(f, "`\\{}` is not a valid escape sequence", character.escape_default().collect::())); @@ -798,9 +800,8 @@ impl<'a> Display for Error<'a> { try!(writeln!(f, "recipe `{}` has duplicate dependency `{}`", recipe, dependency)); } ErrorKind::DuplicateRecipe{recipe, first} => { - try!(write!(f, "recipe `{}` first defined on line {} is redefined on line {}", + try!(writeln!(f, "recipe `{}` first defined on line {} is redefined on line {}", recipe, first, self.line)); - return Ok(()); } ErrorKind::DependencyHasParameters{recipe, dependency} => { try!(writeln!(f, "recipe `{}` depends on `{}` which requires arguments. dependencies may not require arguments", recipe, dependency));