Add try!() around write!()
This commit is contained in:
parent
37f3c90914
commit
d6bd011d95
6 changed files with 19 additions and 20 deletions
|
@ -294,7 +294,7 @@ impl<'a> Module<'a> for BM<'a> {
|
|||
impl<'a> Debug for BM<'a> {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "BM");
|
||||
try!(write!(fmt, "BM"));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ impl<'a> Error for MatchError<'a> {
|
|||
impl<'a> Debug for MatchError<'a> {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "{}", self.format());
|
||||
try!(write!(fmt, "{}", self.format()));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ impl<'a> Debug for MatchError<'a> {
|
|||
impl<'a> Display for MatchError<'a> {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "{}", self.format());
|
||||
try!(write!(fmt, "{}", self.format()));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -97,9 +97,9 @@ impl FileID {
|
|||
impl Debug for FileID {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "FileID[{:?}]: {:?}",
|
||||
try!(write!(fmt, "FileID[{:?}]: {:?}",
|
||||
self.id_type,
|
||||
self.id);
|
||||
self.id));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -108,9 +108,9 @@ impl Debug for FileID {
|
|||
impl Display for FileID {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "FileID[{:?}]: {:?}",
|
||||
try!(write!(fmt, "FileID[{:?}]: {:?}",
|
||||
self.id_type,
|
||||
self.id);
|
||||
self.id));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ impl File {
|
|||
impl Display for File {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt,
|
||||
try!(write!(fmt,
|
||||
"[File] Owner : '{:?}'
|
||||
FileID: '{:?}'
|
||||
Header: '{:?}'
|
||||
|
@ -93,7 +93,7 @@ impl Display for File {
|
|||
self.owning_module_name,
|
||||
self.header,
|
||||
self.data,
|
||||
self.id);
|
||||
self.id));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ impl Display for File {
|
|||
impl Debug for File {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt,
|
||||
try!(write!(fmt,
|
||||
"[File] Owner : '{:?}'
|
||||
FileID: '{:?}'
|
||||
Header: '{:?}'
|
||||
|
@ -110,7 +110,7 @@ impl Debug for File {
|
|||
self.owning_module_name,
|
||||
self.id,
|
||||
self.header,
|
||||
self.data);
|
||||
self.data));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ impl JsonHeaderParser {
|
|||
impl Display for JsonHeaderParser {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "JsonHeaderParser");
|
||||
try!(write!(fmt, "JsonHeaderParser"));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ impl Display for JsonHeaderParser {
|
|||
impl Debug for JsonHeaderParser {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "JsonHeaderParser, Spec: {:?}", self.spec);
|
||||
try!(write!(fmt, "JsonHeaderParser, Spec: {:?}", self.spec));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -57,13 +57,13 @@ impl Error for ParserError {
|
|||
impl Debug for ParserError {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "ParserError: {}\n\n", self.summary);
|
||||
try!(write!(fmt, "ParserError: {}\n\n", self.summary));
|
||||
|
||||
if let Some(ref e) = self.explanation {
|
||||
write!(fmt, "{}\n\n", e);
|
||||
try!(write!(fmt, "{}\n\n", e));
|
||||
}
|
||||
|
||||
write!(fmt, "On position {}\nin\n{}", self.index, self.parsertext);
|
||||
try!(write!(fmt, "On position {}\nin\n{}", self.index, self.parsertext));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -72,10 +72,10 @@ impl Debug for ParserError {
|
|||
impl Display for ParserError {
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "ParserError: {}", self.summary);
|
||||
try!(write!(fmt, "ParserError: {}", self.summary));
|
||||
|
||||
if let Some(ref e) = self.explanation {
|
||||
write!(fmt, "\n\n{}", e);
|
||||
try!(write!(fmt, "\n\n{}", e));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -196,8 +196,7 @@ impl<HP> Debug for Parser<HP>
|
|||
{
|
||||
|
||||
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
|
||||
write!(fmt, "Parser<{:?}>", self.headerp);
|
||||
|
||||
try!(write!(fmt, "Parser<{:?}>", self.headerp));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue