summaryrefslogtreecommitdiffstats
path: root/openpgp/src/packet_pile.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-04-09 17:29:50 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-04-09 18:18:18 +0200
commitc1516c59709fa47d13100daddb57657008a793c3 (patch)
tree25a93149cd56546cdff6b383288cffc0b82941a1 /openpgp/src/packet_pile.rs
parentdbaf698a597a018d9522e8025e9b56e784f0d60b (diff)
openpgp: Remove convenience functions.
Diffstat (limited to 'openpgp/src/packet_pile.rs')
-rw-r--r--openpgp/src/packet_pile.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/openpgp/src/packet_pile.rs b/openpgp/src/packet_pile.rs
index 346b666c..250d9f14 100644
--- a/openpgp/src/packet_pile.rs
+++ b/openpgp/src/packet_pile.rs
@@ -370,8 +370,9 @@ impl<'a> TryFrom<PacketParserResult<'a>> for PacketPile {
let mut pp = ppr.unwrap();
'outer: loop {
+ let recursion_depth = pp.recursion_depth();
let (mut packet, mut ppr) = pp.recurse()?;
- let mut position = ppr.last_recursion_depth().unwrap() as isize;
+ let mut position = recursion_depth as isize;
let mut relative_position : isize = position - last_position;
assert!(relative_position <= 1);
@@ -428,11 +429,11 @@ impl<'a> TryFrom<PacketParserResult<'a>> for PacketPile {
break;
}
+ let recursion_depth = pp.recursion_depth();
let (packet_, ppr_) = pp.recurse()?;
packet = packet_;
ppr = ppr_;
- assert_eq!(position,
- ppr.last_recursion_depth().unwrap() as isize);
+ assert_eq!(position, recursion_depth as isize);
}
}
@@ -622,11 +623,11 @@ mod test {
if let PacketParserResult::Some(pp2) = ppr {
count += 1;
+ let packet_depth = pp2.recursion_depth();
let pp2 = pp2.recurse().unwrap().1;
- let packet_depth = pp2.last_recursion_depth().unwrap();
assert_eq!(packet_depth, count - 1);
if pp2.is_some() {
- assert_eq!(pp2.recursion_depth(), Some(count));
+ assert_eq!(pp2.as_ref().unwrap().recursion_depth(), count);
}
ppr = pp2;
} else {