From 28d7db40edd99f756b4163b5b90163b25aac6123 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 22 Dec 2018 12:22:55 +0100 Subject: [PATCH] Update to Rust 2018 --- Cargo.toml | 1 + examples/hello_world.rs | 9 +-------- src/api.rs | 2 +- src/lib.rs | 25 +++++-------------------- 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 95b536b8..df4b21fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ authors = ["Jimmy Cuadra "] description = "A Matrix client library." documentation = "https://docs.rs/ruma-client" +edition = "2018" homepage = "https://github.com/ruma/ruma-client" keywords = ["matrix", "chat", "messaging", "ruma"] license = "MIT" diff --git a/examples/hello_world.rs b/examples/hello_world.rs index 9f55fe67..ad8caafd 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -1,16 +1,9 @@ #![feature(try_from)] -extern crate futures; -extern crate ruma_client; -extern crate ruma_events; -extern crate ruma_identifiers; -extern crate tokio_core; -extern crate url; - use std::{convert::TryFrom, env, process::exit}; use futures::Future; -use ruma_client::{api::r0, Client}; +use ruma_client::{self, api::r0, Client}; use ruma_events::{ room::message::{MessageEventContent, MessageType, TextMessageEventContent}, EventType, diff --git a/src/api.rs b/src/api.rs index 602d4016..8c99d65d 100644 --- a/src/api.rs +++ b/src/api.rs @@ -29,7 +29,7 @@ macro_rules! endpoint { $($import),* }; - use {Client, Error}; + use crate::{Client, Error}; /// Make a request to this API endpoint. pub fn call( diff --git a/src/lib.rs b/src/lib.rs index 760ff6c6..fba1b29b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,20 +4,6 @@ #![deny(missing_docs)] #![feature(try_from)] -extern crate futures; -extern crate http; -extern crate hyper; -#[cfg(feature = "tls")] -extern crate hyper_tls; -#[cfg(feature = "tls")] -extern crate native_tls; -extern crate ruma_api; -extern crate ruma_client_api; -extern crate ruma_identifiers; -extern crate serde_json; -extern crate serde_urlencoded; -extern crate url; - use std::{cell::RefCell, convert::TryInto, rc::Rc, str::FromStr}; use futures::{ @@ -35,8 +21,7 @@ use native_tls::Error as NativeTlsError; use ruma_api::Endpoint; use url::Url; -pub use error::Error; -pub use session::Session; +pub use crate::{error::Error, session::Session}; /// Matrix client-server API endpoints. pub mod api; @@ -113,7 +98,7 @@ where password: String, device_id: Option, ) -> impl Future { - use api::r0::session::login; + use crate::api::r0::session::login; let data = self.0.clone(); @@ -140,7 +125,7 @@ where /// this method stores the session data returned by the endpoint in this /// client, instead of returning it. pub fn register_guest(&self) -> impl Future { - use api::r0::account::register; + use crate::api::r0::account::register; let data = self.0.clone(); @@ -177,7 +162,7 @@ where username: Option, password: String, ) -> impl Future { - use api::r0::account::register; + use crate::api::r0::account::register; let data = self.0.clone(); @@ -212,7 +197,7 @@ where since: Option, set_presence: bool, ) -> impl Stream { - use api::r0::sync::sync_events; + use crate::api::r0::sync::sync_events; let client = self.clone(); let set_presence = if set_presence {