diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-08-06 11:19:52 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-08-06 11:19:52 +0200 |
commit | aaeb3447b692819bfb16990dfdd44d384eff1e14 (patch) | |
tree | 48fdab51ce484781d1f970981b63dd1490006545 /openpgp/src/types | |
parent | 30fa2d80ac627324350f1533c5630f25ecc9cedc (diff) |
openpgp: Fix formatting of vector and array literals in examples.
- Align our examples with how the code in the examples of the Rust
standard library is formatted. We are writing examples in the
hope that downstream users will copy fragments of them, therefore
using idiomatic formatting in these snippets is important.
Diffstat (limited to 'openpgp/src/types')
-rw-r--r-- | openpgp/src/types/features.rs | 10 | ||||
-rw-r--r-- | openpgp/src/types/key_flags.rs | 6 | ||||
-rw-r--r-- | openpgp/src/types/mod.rs | 2 | ||||
-rw-r--r-- | openpgp/src/types/revocation_key.rs | 4 | ||||
-rw-r--r-- | openpgp/src/types/server_preferences.rs | 6 |
5 files changed, 14 insertions, 14 deletions
diff --git a/openpgp/src/types/features.rs b/openpgp/src/types/features.rs index 1ca88617..7e7e4240 100644 --- a/openpgp/src/types/features.rs +++ b/openpgp/src/types/features.rs @@ -132,8 +132,8 @@ impl Features { /// use openpgp::types::Features; /// /// # fn main() -> Result<()> { - /// let a = Features::new(&[ 0x1 ]); - /// let b = Features::new(&[ 0x1, 0x0 ]); + /// let a = Features::new(&[0x1]); + /// let b = Features::new(&[0x1, 0x0]); /// /// assert!(a != b); /// assert!(a.normalized_eq(&b)); @@ -159,7 +159,7 @@ impl Features { /// /// # fn main() -> Result<()> { /// // Feature flags 0 and 2. - /// let f = Features::new(&[ 0x5 ]); + /// let f = Features::new(&[0x5]); /// /// assert!(f.get(0)); /// assert!(! f.get(1)); @@ -276,7 +276,7 @@ impl Features { /// use openpgp::types::Features; /// /// # fn main() -> Result<()> { - /// let f = Features::new(&[ 0x1 ]); + /// let f = Features::new(&[0x1]); /// assert!(f.supports_mdc()); /// /// let f = f.clear_mdc(); @@ -336,7 +336,7 @@ impl Features { /// use openpgp::types::Features; /// /// # fn main() -> Result<()> { - /// let f = Features::new(&[ 0x2 ]); + /// let f = Features::new(&[0x2]); /// assert!(f.supports_aead()); /// /// let f = f.clear_aead(); diff --git a/openpgp/src/types/key_flags.rs b/openpgp/src/types/key_flags.rs index e25ce6fb..c6d0890f 100644 --- a/openpgp/src/types/key_flags.rs +++ b/openpgp/src/types/key_flags.rs @@ -174,8 +174,8 @@ impl KeyFlags { /// use openpgp::types::KeyFlags; /// /// # fn main() -> openpgp::Result<()> { - /// let a = KeyFlags::new(&[ 0x1 ]); - /// let b = KeyFlags::new(&[ 0x1, 0x0 ]); + /// let a = KeyFlags::new(&[0x1]); + /// let b = KeyFlags::new(&[0x1, 0x0]); /// /// assert!(a != b); /// assert!(a.normalized_eq(&b)); @@ -195,7 +195,7 @@ impl KeyFlags { /// /// # fn main() -> openpgp::Result<()> { /// // Key flags 0 and 2. - /// let kf = KeyFlags::new(&[ 0x5 ]); + /// let kf = KeyFlags::new(&[0x5]); /// /// assert!(kf.get(0)); /// assert!(! kf.get(1)); diff --git a/openpgp/src/types/mod.rs b/openpgp/src/types/mod.rs index 82e239ad..db62415b 100644 --- a/openpgp/src/types/mod.rs +++ b/openpgp/src/types/mod.rs @@ -1455,7 +1455,7 @@ impl Arbitrary for ReasonForRevocation { /// let t1 = t0 + Duration::from_secs(1200); /// let cert1 = cert.clone().merge_packets(sig.clone())?; /// assert_eq!(cert1.revocation_status(p, Some(t1)), -/// RevocationStatus::Revoked(vec![ &sig.into() ])); +/// RevocationStatus::Revoked(vec![&sig.into()])); /// /// // Create a soft revocation (KeySuperseded): /// let sig = CertRevocationBuilder::new() diff --git a/openpgp/src/types/revocation_key.rs b/openpgp/src/types/revocation_key.rs index 90e65ea7..8064a148 100644 --- a/openpgp/src/types/revocation_key.rs +++ b/openpgp/src/types/revocation_key.rs @@ -42,14 +42,14 @@ use crate::{ /// // Make Alice a designated revoker for Bob. /// let (bob, _) = /// CertBuilder::general_purpose(None, Some("bob@example.org")) -/// .set_revocation_keys(vec![ (&alice).into() ]) +/// .set_revocation_keys(vec![(&alice).into()]) /// .generate()?; /// /// // Make sure Alice is listed as a designated revoker for Bob /// // on a component. /// assert_eq!(bob.with_policy(p, None)?.primary_userid()?.revocation_keys(p) /// .collect::<Vec<&RevocationKey>>(), -/// vec![ &(&alice).into() ]); +/// vec![&(&alice).into()]); /// # Ok(()) } /// ``` #[derive(Clone, Debug, PartialEq, Eq, Hash)] diff --git a/openpgp/src/types/server_preferences.rs b/openpgp/src/types/server_preferences.rs index d129ef00..42425d47 100644 --- a/openpgp/src/types/server_preferences.rs +++ b/openpgp/src/types/server_preferences.rs @@ -118,8 +118,8 @@ impl KeyServerPreferences { /// use openpgp::types::KeyServerPreferences; /// /// # fn main() -> openpgp::Result<()> { - /// let a = KeyServerPreferences::new(&[ 0x1 ]); - /// let b = KeyServerPreferences::new(&[ 0x1, 0x0 ]); + /// let a = KeyServerPreferences::new(&[0x1]); + /// let b = KeyServerPreferences::new(&[0x1, 0x0]); /// /// assert!(a != b); /// assert!(a.normalized_eq(&b)); @@ -139,7 +139,7 @@ impl KeyServerPreferences { /// /// # fn main() -> openpgp::Result<()> { /// // Keyserver Preferences flags 0 and 2. - /// let ksp = KeyServerPreferences::new(&[ 0x5 ]); + /// let ksp = KeyServerPreferences::new(&[0x5]); /// /// assert!(ksp.get(0)); /// assert!(! ksp.get(1)); |