diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-07-09 12:51:10 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-07-15 12:47:53 +0200 |
commit | 775f0c039349335df880d35db7df6c131419f0eb (patch) | |
tree | 2d16928f3a629b7afae95cf1b9d518c5603a9f93 /net | |
parent | caec575e3c44e6045e29aa452ad31f91d04ec139 (diff) |
Prepare for Rust 2018.
- This is the result of running `cargo fix --edition`, with some
manual adjustments.
- The vast majority of changes merely qualify module paths with
'crate::'.
- Two instances of adding an anonymous pattern to a trait's
function.
- `async` is a keyword in Rust 2018, and hence it needs to be
escaped (e.g. in the case of the net::r#async module).
- The manual adjustments were needed due to various shortcomings of
the analysis employed by `cargo fix`, e.g. unexpanded macros,
procedural macros, lalrpop grammars.
Diffstat (limited to 'net')
-rw-r--r-- | net/src/async.rs | 10 | ||||
-rw-r--r-- | net/src/lib.rs | 14 | ||||
-rw-r--r-- | net/src/wkd.rs | 14 | ||||
-rw-r--r-- | net/tests/hkp.rs | 8 |
4 files changed, 23 insertions, 23 deletions
diff --git a/net/src/async.rs b/net/src/async.rs index 68a5b61f..efce00bf 100644 --- a/net/src/async.rs +++ b/net/src/async.rs @@ -15,12 +15,12 @@ use std::convert::From; use std::io::Cursor; use url::Url; -use openpgp::TPK; -use openpgp::parse::Parse; -use openpgp::{KeyID, armor, serialize::Serialize}; +use crate::openpgp::TPK; +use crate::openpgp::parse::Parse; +use crate::openpgp::{KeyID, armor, serialize::Serialize}; use sequoia_core::{Context, NetworkPolicy}; -use wkd as net_wkd; +use crate::wkd as net_wkd; use super::{Error, Result}; @@ -148,7 +148,7 @@ impl KeyServer { /// Sends the given key to the server. pub fn send(&mut self, key: &TPK) -> Box<Future<Item=(), Error=failure::Error> + 'static> { - use openpgp::armor::{Writer, Kind}; + use crate::openpgp::armor::{Writer, Kind}; let uri = match self.uri.join("pks/add") { diff --git a/net/src/lib.rs b/net/src/lib.rs index 45415e67..d1fb5df9 100644 --- a/net/src/lib.rs +++ b/net/src/lib.rs @@ -59,25 +59,25 @@ use std::convert::From; use tokio_core::reactor::Core; use url::Url; -use openpgp::KeyID; -use openpgp::TPK; +use crate::openpgp::KeyID; +use crate::openpgp::TPK; use sequoia_core::Context; -pub mod async; -use async::url2uri; +pub mod r#async; +use crate::r#async::url2uri; pub mod wkd; /// For accessing keyservers using HKP. pub struct KeyServer { core: Core, - ks: async::KeyServer, + ks: r#async::KeyServer, } impl KeyServer { /// Returns a handle for the given URI. pub fn new(ctx: &Context, uri: &str) -> Result<Self> { let core = Core::new()?; - let ks = async::KeyServer::new(ctx, uri)?; + let ks = r#async::KeyServer::new(ctx, uri)?; Ok(KeyServer{core: core, ks: ks}) } @@ -86,7 +86,7 @@ impl KeyServer { /// `cert` is used to authenticate the server. pub fn with_cert(ctx: &Context, uri: &str, cert: Certificate) -> Result<Self> { let core = Core::new()?; - let ks = async::KeyServer::with_cert(ctx, uri, cert)?; + let ks = r#async::KeyServer::with_cert(ctx, uri, cert)?; Ok(KeyServer{core: core, ks: ks}) } diff --git a/net/src/wkd.rs b/net/src/wkd.rs index f8217731..6d4613db 100644 --- a/net/src/wkd.rs +++ b/net/src/wkd.rs @@ -28,11 +28,11 @@ use nettle::{ use tokio_core::reactor::Core; use url; -use openpgp::TPK; -use openpgp::parse::Parse; -use openpgp::tpk::TPKParser; +use crate::openpgp::TPK; +use crate::openpgp::parse::Parse; +use crate::openpgp::tpk::TPKParser; -use super::{Result, Error, async}; +use super::{Result, Error, r#async}; /// Stores the local_part and domain of an email address. @@ -210,14 +210,14 @@ pub(crate) fn parse_body<S: AsRef<str>>(body: &[u8], email_address: S) // XXX: Maybe implement WkdServer and AWkdClient. pub fn get<S: AsRef<str>>(email_address: S) -> Result<Vec<TPK>> { let mut core = Core::new()?; - core.run(async::wkd::get(&email_address)) + core.run(r#async::wkd::get(&email_address)) } #[cfg(test)] mod tests { - use openpgp::serialize::Serialize; - use openpgp::tpk::TPKBuilder; + use crate::openpgp::serialize::Serialize; + use crate::openpgp::tpk::TPKBuilder; use super::*; diff --git a/net/tests/hkp.rs b/net/tests/hkp.rs index 0faf40a5..65e5e83f 100644 --- a/net/tests/hkp.rs +++ b/net/tests/hkp.rs @@ -22,10 +22,10 @@ extern crate sequoia_openpgp as openpgp; extern crate sequoia_core; extern crate sequoia_net; -use openpgp::armor::Reader; -use openpgp::TPK; -use openpgp::{Fingerprint, KeyID}; -use openpgp::parse::Parse; +use crate::openpgp::armor::Reader; +use crate::openpgp::TPK; +use crate::openpgp::{Fingerprint, KeyID}; +use crate::openpgp::parse::Parse; use sequoia_core::{Context, NetworkPolicy}; use sequoia_net::KeyServer; |