diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-12-19 14:15:21 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-12-20 18:04:56 +0100 |
commit | 046cbc7837cfae8505cb77cdc0352eeaac023a85 (patch) | |
tree | acd00a0e9043b83648a749a32602b870e2bacbf4 /openpgp/src/packet_pile.rs | |
parent | 103379888e9d0ccc701a24f2adb539bc9095f10b (diff) |
openpgp: Move fields from Common to Container.
Diffstat (limited to 'openpgp/src/packet_pile.rs')
-rw-r--r-- | openpgp/src/packet_pile.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/openpgp/src/packet_pile.rs b/openpgp/src/packet_pile.rs index a290f841..5b548de1 100644 --- a/openpgp/src/packet_pile.rs +++ b/openpgp/src/packet_pile.rs @@ -74,7 +74,7 @@ impl std::str::FromStr for PacketPile { impl From<Vec<Packet>> for PacketPile { fn from(p: Vec<Packet>) -> Self { - PacketPile { top_level: Container { packets: p } } + PacketPile { top_level: Container::from(p) } } } @@ -246,11 +246,10 @@ impl PacketPile { let p = &mut tmp.packets[i]; if p.children_ref().is_none() { match p { - Packet::CompressedData(_) | Packet::SEIP(_) => { - // We have a container with no children. - // That's okay. We can create the container. - p.set_children(Some(Container::new())); - }, + Packet::CompressedData(_) + | Packet::SEIP(_) + | Packet::AED(_) + => (), // Ok. _ => { return Err(Error::IndexOutOfRange.into()); } @@ -304,7 +303,7 @@ impl PacketPile { } // Create a top-level container. - let mut top_level = Container::new(); + let mut top_level = Container::default(); let mut last_position = 0; @@ -348,7 +347,6 @@ impl PacketPile { let tmp = container; let i = tmp.packets.len() - 1; assert!(tmp.packets[i].children_ref().is_none()); - tmp.packets[i].set_children(Some(Container::new())); container = tmp.packets[i].children_mut().unwrap(); } @@ -640,7 +638,6 @@ mod test { } let mut seip = SEIP1::new(); - seip.set_children(Some(Container::new())); seip.children_mut().unwrap().push(cd.into()); packets.push(seip.into()); |