Merge pull request #295 from ErichDonGubler/fix_warnings
Fix warnings for deprecated usages of trim_{left,right}_matches.
This commit is contained in:
commit
743cfcef05
|
@ -99,7 +99,7 @@ impl fmt::Display for Time {
|
||||||
write!(f, "{:02}:{:02}:{:02}", self.hour, self.minute, self.second)?;
|
write!(f, "{:02}:{:02}:{:02}", self.hour, self.minute, self.second)?;
|
||||||
if self.nanosecond != 0 {
|
if self.nanosecond != 0 {
|
||||||
let s = format!("{:09}", self.nanosecond);
|
let s = format!("{:09}", self.nanosecond);
|
||||||
write!(f, ".{}", s.trim_right_matches('0'))?;
|
write!(f, ".{}", s.trim_end_matches('0'))?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1321,7 +1321,7 @@ impl<'a> Deserializer<'a> {
|
||||||
if suffix != "" {
|
if suffix != "" {
|
||||||
return Err(self.error(start, ErrorKind::NumberInvalid));
|
return Err(self.error(start, ErrorKind::NumberInvalid));
|
||||||
}
|
}
|
||||||
i64::from_str_radix(&prefix.replace("_", "").trim_left_matches('+'), radix)
|
i64::from_str_radix(&prefix.replace("_", "").trim_start_matches('+'), radix)
|
||||||
.map_err(|_e| self.error(start, ErrorKind::NumberInvalid))
|
.map_err(|_e| self.error(start, ErrorKind::NumberInvalid))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1399,7 +1399,7 @@ impl<'a> Deserializer<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut number = integral
|
let mut number = integral
|
||||||
.trim_left_matches('+')
|
.trim_start_matches('+')
|
||||||
.chars()
|
.chars()
|
||||||
.filter(|c| *c != '_')
|
.filter(|c| *c != '_')
|
||||||
.collect::<String>();
|
.collect::<String>();
|
||||||
|
|
|
@ -19,7 +19,7 @@ fn to_json(toml: toml::Value) -> Json {
|
||||||
Toml::Integer(i) => doit("integer", Json::String(i.to_string())),
|
Toml::Integer(i) => doit("integer", Json::String(i.to_string())),
|
||||||
Toml::Float(f) => doit("float", Json::String({
|
Toml::Float(f) => doit("float", Json::String({
|
||||||
let s = format!("{:.15}", f);
|
let s = format!("{:.15}", f);
|
||||||
let s = format!("{}", s.trim_right_matches('0'));
|
let s = format!("{}", s.trim_end_matches('0'));
|
||||||
if s.ends_with('.') {format!("{}0", s)} else {s}
|
if s.ends_with('.') {format!("{}0", s)} else {s}
|
||||||
})),
|
})),
|
||||||
Toml::Boolean(b) => doit("bool", Json::String(format!("{}", b))),
|
Toml::Boolean(b) => doit("bool", Json::String(format!("{}", b))),
|
||||||
|
|
Loading…
Reference in a new issue