Restore compatibility with rustc 1.31 in RenameRule error
str::escape_debug wasn't stabilized until 1.34, whereas serde_derive currently supports an oldest version of 1.31.
This commit is contained in:
parent
4e002ece07
commit
b7bad3a165
@ -5,7 +5,7 @@
|
||||
#[allow(deprecated, unused_imports)]
|
||||
use std::ascii::AsciiExt;
|
||||
|
||||
use std::fmt::{self, Display};
|
||||
use std::fmt::{self, Debug, Display};
|
||||
|
||||
use self::RenameRule::*;
|
||||
|
||||
@ -120,16 +120,14 @@ pub struct ParseError<'a> {
|
||||
|
||||
impl<'a> Display for ParseError<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.write_str("unknown rename rule `rename_all = \"")?;
|
||||
self.unknown.escape_debug().fmt(f)?;
|
||||
f.write_str("\"`, expected one of ")?;
|
||||
f.write_str("unknown rename rule `rename_all = ")?;
|
||||
Debug::fmt(self.unknown, f)?;
|
||||
f.write_str("`, expected one of ")?;
|
||||
for (i, (name, _rule)) in RENAME_RULES.iter().enumerate() {
|
||||
if i > 0 {
|
||||
f.write_str(", ")?;
|
||||
}
|
||||
f.write_str("\"")?;
|
||||
name.escape_debug().fmt(f)?;
|
||||
f.write_str("\"")?;
|
||||
Debug::fmt(name, f)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user