mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-11 07:34:18 +00:00
fix clippy::single-match-else and clippy::match_same_arms warnings in clippys codebase
This commit is contained in:
parent
2a31937cc9
commit
9fae4693f9
2 changed files with 11 additions and 13 deletions
|
@ -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(
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue