mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
implement clippy suggestion to use if
as an expression
This commit is contained in:
parent
018e8dea6e
commit
230d353367
@ -564,8 +564,7 @@ pub struct EncodeState<'a> {
|
||||
|
||||
impl<'a> EncodeState<'a> {
|
||||
pub fn new(resolve: &'a Resolve) -> EncodeState<'a> {
|
||||
let mut counts = None;
|
||||
if *resolve.version() == ResolveVersion::V2 {
|
||||
let counts = if *resolve.version() == ResolveVersion::V2 {
|
||||
let mut map = HashMap::new();
|
||||
for id in resolve.iter() {
|
||||
let slot = map
|
||||
@ -575,8 +574,10 @@ impl<'a> EncodeState<'a> {
|
||||
.or_insert(0);
|
||||
*slot += 1;
|
||||
}
|
||||
counts = Some(map);
|
||||
}
|
||||
Some(map)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
EncodeState { counts }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user