clippy: remove explicit returns
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
d8d8af9826
commit
38556bf60d
@ -46,7 +46,7 @@ fn apt_update_available(_param: Value) -> Result<Value, Error> {
|
||||
|
||||
let cache = apt::update_cache()?;
|
||||
|
||||
return Ok(json!(cache.package_status));
|
||||
Ok(json!(cache.package_status))
|
||||
}
|
||||
|
||||
fn do_apt_update(worker: &WorkerTask, quiet: bool) -> Result<(), Error> {
|
||||
@ -205,7 +205,7 @@ fn apt_get_changelog(
|
||||
if changelog_url.starts_with("http://download.proxmox.com/") {
|
||||
let changelog = crate::tools::runtime::block_on(http::get_string(changelog_url, None))
|
||||
.map_err(|err| format_err!("Error downloading changelog from '{}': {}", changelog_url, err))?;
|
||||
return Ok(json!(changelog));
|
||||
Ok(json!(changelog))
|
||||
|
||||
} else if changelog_url.starts_with("https://enterprise.proxmox.com/") {
|
||||
let sub = match subscription::read_subscription()? {
|
||||
@ -229,7 +229,7 @@ fn apt_get_changelog(
|
||||
|
||||
let changelog = crate::tools::runtime::block_on(http::get_string(changelog_url, Some(&auth_header)))
|
||||
.map_err(|err| format_err!("Error downloading changelog from '{}': {}", changelog_url, err))?;
|
||||
return Ok(json!(changelog));
|
||||
Ok(json!(changelog))
|
||||
|
||||
} else {
|
||||
let mut command = std::process::Command::new("apt-get");
|
||||
@ -237,7 +237,7 @@ fn apt_get_changelog(
|
||||
command.arg("-qq"); // don't display download progress
|
||||
command.arg(name);
|
||||
let output = crate::tools::run_command(command, None)?;
|
||||
return Ok(json!(output));
|
||||
Ok(json!(output))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ fn restore_snapshot_archive<'a>(
|
||||
|
||||
let mut decoder = pxar::decoder::sync::Decoder::from_std(reader)?;
|
||||
match try_restore_snapshot_archive(&mut decoder, snapshot_path) {
|
||||
Ok(()) => return Ok(true),
|
||||
Ok(()) => Ok(true),
|
||||
Err(err) => {
|
||||
let reader = decoder.input();
|
||||
|
||||
@ -421,7 +421,7 @@ fn restore_snapshot_archive<'a>(
|
||||
}
|
||||
|
||||
// else the archive is corrupt
|
||||
return Err(err);
|
||||
Err(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ async fn get_status(
|
||||
}
|
||||
let text = value.as_str().unwrap().to_string();
|
||||
if text.is_empty() {
|
||||
return Ok(String::from("--FULL--"));
|
||||
Ok(String::from("--FULL--"))
|
||||
} else {
|
||||
Ok(text)
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ impl AclTree {
|
||||
/// Iterates over the tree looking for a node matching `path`.
|
||||
pub fn find_node(&mut self, path: &str) -> Option<&mut AclTreeNode> {
|
||||
let path = split_acl_path(path);
|
||||
return self.get_node(&path);
|
||||
self.get_node(&path)
|
||||
}
|
||||
|
||||
fn get_node(&mut self, path: &[&str]) -> Option<&mut AclTreeNode> {
|
||||
|
@ -98,7 +98,7 @@ impl CachedUserInfo {
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
true
|
||||
}
|
||||
|
||||
pub fn check_privs(
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)");
|
||||
|
@ -33,7 +33,7 @@ pub fn do_verification_job(
|
||||
|
||||
let raw_verify_state = manifest.unprotected["verify_state"].clone();
|
||||
match serde_json::from_value::<SnapshotVerifyState>(raw_verify_state) {
|
||||
Err(_) => return true, // no last verification, always include
|
||||
Err(_) => true, // no last verification, always include
|
||||
Ok(last_verify) => {
|
||||
match outdated_after {
|
||||
None => false, // never re-verify if ignored and no max age
|
||||
|
@ -246,13 +246,13 @@ pub fn required_media_changer(
|
||||
) -> Result<(Box<dyn MediaChange>, String), Error> {
|
||||
match media_changer(config, drive) {
|
||||
Ok(Some(result)) => {
|
||||
return Ok(result);
|
||||
Ok(result)
|
||||
}
|
||||
Ok(None) => {
|
||||
bail!("drive '{}' has no associated changer device", drive);
|
||||
},
|
||||
Err(err) => {
|
||||
return Err(err);
|
||||
Err(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -327,7 +327,7 @@ pub fn request_and_load_media(
|
||||
|
||||
let media_id = check_label(handle.as_mut(), &label.uuid)?;
|
||||
|
||||
return Ok((handle, media_id));
|
||||
Ok((handle, media_id))
|
||||
}
|
||||
"linux" => {
|
||||
let drive_config = LinuxTapeDrive::deserialize(config)?;
|
||||
|
@ -179,7 +179,7 @@ impl <R: Read> Read for BlockedReader<R> {
|
||||
}
|
||||
|
||||
if rest <= 0 {
|
||||
return Ok(0);
|
||||
Ok(0)
|
||||
} else {
|
||||
let copy_len = if (buffer.len() as isize) < rest {
|
||||
buffer.len()
|
||||
@ -189,7 +189,7 @@ impl <R: Read> Read for BlockedReader<R> {
|
||||
buffer[..copy_len].copy_from_slice(
|
||||
&self.buffer.payload[self.read_pos..(self.read_pos + copy_len)]);
|
||||
self.read_pos += copy_len;
|
||||
return Ok(copy_len);
|
||||
Ok(copy_len)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ pub fn list_installed_apt_packages<F: Fn(FilterData) -> bool>(
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
ret
|
||||
}
|
||||
|
||||
fn query_detailed_info<'a, F, V>(
|
||||
@ -366,5 +366,5 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
return None;
|
||||
None
|
||||
}
|
||||
|
@ -725,7 +725,7 @@ pub fn get_disk_usage_info(
|
||||
filter.push(disk.to_string());
|
||||
let mut map = get_disks(Some(filter), no_smart)?;
|
||||
if let Some(info) = map.remove(disk) {
|
||||
return Ok(info);
|
||||
Ok(info)
|
||||
} else {
|
||||
bail!("failed to get disk usage info - internal error"); // should not happen
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user