fix clippy::single-match-else and clippy::match_same_arms warnings in clippys codebase

This commit is contained in:
Matthias Krüger 2018-09-26 11:44:50 +02:00
parent 2a31937cc9
commit 9fae4693f9
2 changed files with 11 additions and 13 deletions

View file

@ -46,9 +46,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DurationSubsec {
if let Some((Constant::Int(divisor), _)) = constant(cx, cx.tables, right);
then {
let suggested_fn = match (method_path.ident.as_str().as_ref(), divisor) {
("subsec_micros", 1_000) => "subsec_millis",
("subsec_micros", 1_000) | ("subsec_nanos", 1_000_000) => "subsec_millis",
("subsec_nanos", 1_000) => "subsec_micros",
("subsec_nanos", 1_000_000) => "subsec_millis",
_ => return,
};
span_lint_and_sugg(

View file

@ -41,9 +41,9 @@ impl LintPass for Pass {
impl EarlyLintPass for Pass {
fn check_crate(&mut self, cx: &EarlyContext<'_>, krate: &Crate) {
let metadata = match cargo_metadata::metadata_deps(None, true) {
Ok(metadata) => metadata,
Err(_) => {
let metadata = if let Ok(metadata) = cargo_metadata::metadata_deps(None, true) {
metadata
} else {
span_lint(
cx,
MULTIPLE_CRATE_VERSIONS,
@ -52,7 +52,6 @@ impl EarlyLintPass for Pass {
);
return;
}
};
let mut packages = metadata.packages;