summaryrefslogtreecommitdiffstats
path: root/openpgp/src/parse/packet_pile_parser.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-12-19 14:15:21 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-12-20 18:04:56 +0100
commit046cbc7837cfae8505cb77cdc0352eeaac023a85 (patch)
treeacd00a0e9043b83648a749a32602b870e2bacbf4 /openpgp/src/parse/packet_pile_parser.rs
parent103379888e9d0ccc701a24f2adb539bc9095f10b (diff)
openpgp: Move fields from Common to Container.
Diffstat (limited to 'openpgp/src/parse/packet_pile_parser.rs')
-rw-r--r--openpgp/src/parse/packet_pile_parser.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/openpgp/src/parse/packet_pile_parser.rs b/openpgp/src/parse/packet_pile_parser.rs
index 58a93718..223b212b 100644
--- a/openpgp/src/parse/packet_pile_parser.rs
+++ b/openpgp/src/parse/packet_pile_parser.rs
@@ -4,7 +4,6 @@ use std::path::Path;
use crate::{
Result,
Packet,
- Container,
PacketPile,
};
use crate::parse::{
@@ -109,7 +108,7 @@ impl<'a> PacketPileParser<'a> {
-> Result<PacketPileParser<'a>>
{
Ok(PacketPileParser {
- pile: PacketPile { top_level: Container::new() },
+ pile: PacketPile { top_level: Default::default() },
ppr: ppr,
returned_first: false,
})
@@ -135,13 +134,8 @@ impl<'a> PacketPileParser<'a> {
let packets_len = tmp.packets.len();
let p = &mut tmp.packets[packets_len - 1];
if p.children().next().is_none() {
- if i == position - 1 {
- // This is the leaf. Create a new container
- // here.
- p.set_children(Some(Container::new()));
- } else {
- panic!("Internal inconsistency while building message.");
- }
+ assert!(i == position - 1,
+ "Internal inconsistency while building message.");
}
container = p.children_mut().unwrap();