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,18 +41,17 @@ 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(_) => {
span_lint(
cx,
MULTIPLE_CRATE_VERSIONS,
krate.span,
"could not read cargo metadata"
);
let metadata = if let Ok(metadata) = cargo_metadata::metadata_deps(None, true) {
metadata
} else {
span_lint(
cx,
MULTIPLE_CRATE_VERSIONS,
krate.span,
"could not read cargo metadata"
);
return;
}
return;
};
let mut packages = metadata.packages;