Skip to content

Commit

Permalink
clippy: remove uneeded returns
Browse files Browse the repository at this point in the history
New rule blocks CI since `validation` against clippy is failing hence
remove needless returns from serve and run.

See: https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

Clone of: #208

Signed-off-by: Aditya R <arajan@redhat.com>
  • Loading branch information
flouthoc committed Aug 29, 2022
1 parent e40160b commit 2089dfb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ impl Run {
}
Err(err) => {
log::debug!("fork failed with error {}", err);
return Err(std::io::Error::new(
Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("fork failed with error: {}", err),
));
))
}
}
}
Expand Down
30 changes: 12 additions & 18 deletions src/server/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,10 @@ fn core_serve_loop(

Ok(())
}
Err(e) => {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("unable to parse config: {}", e),
))
}
Err(e) => Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("unable to parse config: {}", e),
)),
}
}

Expand Down Expand Up @@ -229,19 +227,15 @@ async fn start_dns_server(
{
Ok(mut server) => match server.run().await {
Ok(_) => Ok(()),
Err(e) => {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("unable to start CoreDns server: {}", e),
))
}
},
Err(e) => {
return Err(std::io::Error::new(
Err(e) => Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("unable to create CoreDns server: {}", e),
))
}
format!("unable to start CoreDns server: {}", e),
)),
},
Err(e) => Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("unable to create CoreDns server: {}", e),
)),
}
}

Expand Down

0 comments on commit 2089dfb

Please sign in to comment.