summaryrefslogtreecommitdiffstats
path: root/guide
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-01-10 13:47:51 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-01-10 13:56:13 +0100
commitcb001fdaec7e6fa91109f7649ab170e534ec7227 (patch)
treee2d433561c58a99e77a258efba41a432e6aee893 /guide
parent6a0321845194931740fe7376f115f897d86a0084 (diff)
openpgp: Prefer consuming MessageStructure's to referencing them.
Diffstat (limited to 'guide')
-rw-r--r--guide/src/chapter_01.md24
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 { .. }) =>