clippy: remove explicit returns

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2021-01-19 10:50:42 +01:00
parent d8d8af9826
commit 38556bf60d
13 changed files with 28 additions and 28 deletions

View File

@ -61,7 +61,7 @@ lazy_static! {
pub fn parse_cidr(cidr: &str) -> Result<(String, u8, bool), Error> {
let (address, mask, is_v6) = parse_address_or_cidr(cidr)?;
if let Some(mask) = mask {
return Ok((address, mask, is_v6));
Ok((address, mask, is_v6))
} else {
bail!("missing netmask in '{}'", cidr);
}
@ -98,18 +98,18 @@ pub fn parse_address_or_cidr(cidr: &str) -> Result<(String, Option<u8>, bool), E
if let Some(mask) = caps.get(2) {
let mask = u8::from_str_radix(mask.as_str(), 10)?;
check_netmask(mask, false)?;
return Ok((address.to_string(), Some(mask), false));
Ok((address.to_string(), Some(mask), false))
} else {
return Ok((address.to_string(), None, false));
Ok((address.to_string(), None, false))
}
} else if let Some(caps) = CIDR_V6_REGEX.captures(&cidr) {
let address = &caps[1];
if let Some(mask) = caps.get(2) {
let mask = u8::from_str_radix(mask.as_str(), 10)?;
check_netmask(mask, true)?;
return Ok((address.to_string(), Some(mask), true));
Ok((address.to_string(), Some(mask), true))
} else {
return Ok((address.to_string(), None, true));
Ok((address.to_string(), None, true))
}
} else {
bail!("invalid address/mask '{}'", cidr);

View File

@ -114,14 +114,14 @@ impl <R: BufRead> Iterator for Lexer<R> {
Some(ref mut cur_line) => {
if cur_line.is_empty() {
self.cur_line = None;
return Some(Ok((Token::Newline, String::from("\n"))));
Some(Ok((Token::Newline, String::from("\n"))))
} else {
let (token, text) = cur_line.pop_front().unwrap();
return Some(Ok((token, text)));
Some(Ok((token, text)))
}
}
None => {
return None;
None
}
}
}

View File

@ -29,7 +29,7 @@ impl <R: BufRead> NetworkParser<R> {
bail!("input error - {}", err);
}
Some(Ok((token, _))) => {
return Ok(*token);
Ok(*token)
}
None => {
bail!("got unexpected end of stream (inside peek)");
@ -44,7 +44,7 @@ impl <R: BufRead> NetworkParser<R> {
}
Some(Ok((token, text))) => {
if token == Token::Newline { self.line_nr += 1; }
return Ok((token, text));
Ok((token, text))
}
None => {
bail!("got unexpected end of stream (inside peek)");