Fix Clippy lints: or_fun_call
This commit is contained in:
parent
fd6036a8b9
commit
4a70e160fb
|
@ -36,7 +36,8 @@ pub fn number(s: &str, min: usize, max: usize) -> ParseResult<(&str, i64)> {
|
||||||
if window.len() > max { window = &window[..max]; }
|
if window.len() > max { window = &window[..max]; }
|
||||||
|
|
||||||
// scan digits
|
// scan digits
|
||||||
let upto = window.iter().position(|&c| c < b'0' || b'9' < c).unwrap_or(window.len());
|
let upto = window.iter().position(|&c| c < b'0' || b'9' < c)
|
||||||
|
.unwrap_or_else(|| window.len());
|
||||||
if upto < min {
|
if upto < min {
|
||||||
return Err(if window.is_empty() {TOO_SHORT} else {INVALID});
|
return Err(if window.is_empty() {TOO_SHORT} else {INVALID});
|
||||||
}
|
}
|
||||||
|
@ -224,7 +225,8 @@ pub fn timezone_offset_zulu<F>(s: &str, colon: F) -> ParseResult<(&str, i32)>
|
||||||
pub fn timezone_offset_2822(s: &str) -> ParseResult<(&str, Option<i32>)> {
|
pub fn timezone_offset_2822(s: &str) -> ParseResult<(&str, Option<i32>)> {
|
||||||
// tries to parse legacy time zone names
|
// tries to parse legacy time zone names
|
||||||
let upto = s.as_bytes().iter().position(|&c| match c { b'a'...b'z' | b'A'...b'Z' => false,
|
let upto = s.as_bytes().iter().position(|&c| match c { b'a'...b'z' | b'A'...b'Z' => false,
|
||||||
_ => true }).unwrap_or(s.len());
|
_ => true })
|
||||||
|
.unwrap_or_else(|| s.len());
|
||||||
if upto > 0 {
|
if upto > 0 {
|
||||||
let name = &s[..upto];
|
let name = &s[..upto];
|
||||||
let s = &s[upto..];
|
let s = &s[upto..];
|
||||||
|
|
|
@ -305,7 +305,7 @@ impl<'a> Iterator for StrftimeItems<'a> {
|
||||||
Some(c) if c.is_whitespace() => {
|
Some(c) if c.is_whitespace() => {
|
||||||
// `%` is not a whitespace, so `c != '%'` is redundant
|
// `%` is not a whitespace, so `c != '%'` is redundant
|
||||||
let nextspec = self.remainder.find(|c: char| !c.is_whitespace())
|
let nextspec = self.remainder.find(|c: char| !c.is_whitespace())
|
||||||
.unwrap_or(self.remainder.len());
|
.unwrap_or_else(|| self.remainder.len());
|
||||||
assert!(nextspec > 0);
|
assert!(nextspec > 0);
|
||||||
let item = sp!(&self.remainder[..nextspec]);
|
let item = sp!(&self.remainder[..nextspec]);
|
||||||
self.remainder = &self.remainder[nextspec..];
|
self.remainder = &self.remainder[nextspec..];
|
||||||
|
@ -315,7 +315,7 @@ impl<'a> Iterator for StrftimeItems<'a> {
|
||||||
// the next item is literal
|
// the next item is literal
|
||||||
_ => {
|
_ => {
|
||||||
let nextspec = self.remainder.find(|c: char| c.is_whitespace() || c == '%')
|
let nextspec = self.remainder.find(|c: char| c.is_whitespace() || c == '%')
|
||||||
.unwrap_or(self.remainder.len());
|
.unwrap_or_else(|| self.remainder.len());
|
||||||
assert!(nextspec > 0);
|
assert!(nextspec > 0);
|
||||||
let item = lit!(&self.remainder[..nextspec]);
|
let item = lit!(&self.remainder[..nextspec]);
|
||||||
self.remainder = &self.remainder[nextspec..];
|
self.remainder = &self.remainder[nextspec..];
|
||||||
|
|
Loading…
Reference in New Issue