summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-02-06 11:23:36 +0100
committerJustus Winter <justus@sequoia-pgp.org>2018-02-06 11:23:36 +0100
commitb2f1c2b6a0b72113d395ff9465e837416f28df0f (patch)
treede2c6ddbf9b1275fb7753b717f16df3fd220ba69
parent0e976ba17b2670b2c50b80b972aab496b3767836 (diff)
openpgp: Improve armored! macro.
- Use $crate to refer to the current crate making this macro easier to use. - Simplify examples accordingly.
-rw-r--r--examples/guide-exploring-openpgp.rs4
-rw-r--r--examples/guide-getting-started.rs4
-rw-r--r--examples/guide-the-keystore.rs4
-rw-r--r--openpgp/src/armor.rs4
4 files changed, 8 insertions, 8 deletions
diff --git a/examples/guide-exploring-openpgp.rs b/examples/guide-exploring-openpgp.rs
index f8d71de9..af4b7a7d 100644
--- a/examples/guide-exploring-openpgp.rs
+++ b/examples/guide-exploring-openpgp.rs
@@ -1,7 +1,7 @@
//! https://preview.sequoia-pgp.org/guide/exploring-openpgp/
-#[macro_use] extern crate openpgp; // For armored!
-use openpgp::armor; // For armored!
+#[macro_use] // For armored!
+extern crate openpgp;
fn main() {
let mut reader = armored!(
diff --git a/examples/guide-getting-started.rs b/examples/guide-getting-started.rs
index 0b9b3a13..c1866078 100644
--- a/examples/guide-getting-started.rs
+++ b/examples/guide-getting-started.rs
@@ -1,7 +1,7 @@
//! https://preview.sequoia-pgp.org/guide/getting-started/
-#[macro_use] extern crate openpgp; // For armored!
-use openpgp::armor; // For armored!
+#[macro_use] // For armored!
+extern crate openpgp;
use std::io;
fn main() {
diff --git a/examples/guide-the-keystore.rs b/examples/guide-the-keystore.rs
index effd9e71..0baa8a05 100644
--- a/examples/guide-the-keystore.rs
+++ b/examples/guide-the-keystore.rs
@@ -1,7 +1,7 @@
//! https://preview.sequoia-pgp.org/guide/the-keystore/
-#[macro_use] extern crate openpgp; // For armored!
-use openpgp::armor; // For armored!
+#[macro_use] // For armored!
+extern crate openpgp;
extern crate sequoia;
use sequoia::{core, store};
diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs
index f6650e6b..aee92500 100644
--- a/openpgp/src/armor.rs
+++ b/openpgp/src/armor.rs
@@ -579,7 +579,6 @@ impl<W: Read> Read for Reader<W> {
/// ```
/// use std::io::Read;
/// #[macro_use] extern crate openpgp;
-/// use openpgp::armor;
/// # use std::io::Result;
/// # fn main() { f().unwrap(); }
/// # fn f() -> Result<()> {
@@ -601,7 +600,8 @@ impl<W: Read> Read for Reader<W> {
macro_rules! armored {
($data:expr) => {{
use ::std::io::Cursor;
- armor::Reader::new(Cursor::new(&$data), armor::Kind::Any)
+ $crate::armor::Reader::new(Cursor::new(&$data),
+ $crate::armor::Kind::Any)
}};
}