diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-01-10 13:47:51 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-01-10 13:56:13 +0100 |
commit | cb001fdaec7e6fa91109f7649ab170e534ec7227 (patch) | |
tree | e2d433561c58a99e77a258efba41a432e6aee893 /guide | |
parent | 6a0321845194931740fe7376f115f897d86a0084 (diff) |
openpgp: Prefer consuming MessageStructure's to referencing them.
Diffstat (limited to 'guide')
-rw-r--r-- | guide/src/chapter_01.md | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/guide/src/chapter_01.md b/guide/src/chapter_01.md index fa4b505c..3c0ab811 100644 --- a/guide/src/chapter_01.md +++ b/guide/src/chapter_01.md @@ -108,15 +108,15 @@ fn main() { # // policy. # # let mut good = false; -# for (i, layer) in structure.iter().enumerate() { +# for (i, layer) in structure.into_iter().enumerate() { # match (i, layer) { # // First, we are interested in signatures over the # // data, i.e. level 0 signatures. -# (0, MessageLayer::SignatureGroup { ref results }) => { +# (0, MessageLayer::SignatureGroup { results }) => { # // Finally, given a VerificationResult, which only says # // whether the signature checks out mathematically, we apply # // our policy. -# match results.get(0) { +# match results.into_iter().next() { # Some(VerificationResult::GoodChecksum { .. }) => # good = true, # Some(VerificationResult::NotAlive { .. }) => @@ -253,15 +253,15 @@ fn generate() -> openpgp::Result<openpgp::Cert> { # // policy. # # let mut good = false; -# for (i, layer) in structure.iter().enumerate() { +# for (i, layer) in structure.into_iter().enumerate() { # match (i, layer) { # // First, we are interested in signatures over the # // data, i.e. level 0 signatures. -# (0, MessageLayer::SignatureGroup { ref results }) => { +# (0, MessageLayer::SignatureGroup { results }) => { # // Finally, given a VerificationResult, which only says # // whether the signature checks out mathematically, we apply # // our policy. -# match results.get(0) { +# match results.into_iter().next() { # Some(VerificationResult::GoodChecksum { .. }) => # good = true, # Some(VerificationResult::NotAlive { .. }) => @@ -398,15 +398,15 @@ fn sign(sink: &mut Write, plaintext: &str, tsk: &openpgp::Cert) # // policy. # # let mut good = false; -# for (i, layer) in structure.iter().enumerate() { +# for (i, layer) in structure.into_iter().enumerate() { # match (i, layer) { # // First, we are interested in signatures over the # // data, i.e. level 0 signatures. -# (0, MessageLayer::SignatureGroup { ref results }) => { +# (0, MessageLayer::SignatureGroup { results }) => { # // Finally, given a VerificationResult, which only says # // whether the signature checks out mathematically, we apply # // our policy. -# match results.get(0) { +# match results.into_iter().next() { # Some(VerificationResult::GoodChecksum { .. }) => # good = true, # Some(VerificationResult::NotAlive { .. }) => @@ -554,15 +554,15 @@ impl<'a> VerificationHelper for Helper<'a> { // policy. let mut good = false; - for (i, layer) in structure.iter().enumerate() { + for (i, layer) in structure.into_iter().enumerate() { match (i, layer) { // First, we are interested in signatures over the // data, i.e. level 0 signatures. - (0, MessageLayer::SignatureGroup { ref results }) => { + (0, MessageLayer::SignatureGroup { results }) => { // Finally, given a VerificationResult, which only says // whether the signature checks out mathematically, we apply // our policy. - match results.get(0) { + match results.into_iter().next() { Some(VerificationResult::GoodChecksum { .. }) => good = true, Some(VerificationResult::NotAlive { .. }) => |