Skip to content

Commit

Permalink
Refactored to use the entry api for the crypto_blocks map.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Bury committed Mar 1, 2024
1 parent 865a6c7 commit 5ac611a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions procfs-core/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ impl FromBufRead for CryptoTable {
if name.trim() == "name" {
let name = expect!(split.next()).trim().to_string();
let block = CryptoBlock::from_iter(&mut lines, name.as_str())?;
if let Some(v) = crypto_blocks.get_mut(&name) {
v.push(block);
} else {
crypto_blocks.insert(name, vec![block]);
}
let blocks = crypto_blocks.entry(name).or_insert(Vec::new());
blocks.push(block);
}
}
}
Expand Down

0 comments on commit 5ac611a

Please sign in to comment.