Skip to content

Commit 37b62a3

Browse files
ascjonestomusdrw
authored andcommitted
Migrate to edition 2018 (#368)
* core: cargo fix --edition * core: edition = 2018 * http: cargo fix --edition * http: edition = 2018 * ipc: edition 2018 * pubsub: edition 2018 * pubsub: cargo fix --edition-idioms --broken-code, then fixed compile errors * server-utils: cargo fix --edition * server-utils: edition 2018 * server-utils: cargo fix --edition-idioms --broken-code * stdio: edition 2018 * stdio: edition 2018 idioms * tcp: edition 2018 * tcp: edition 2018 idioms * test: edition 2018 * test: edition 2018 idioms * ws: edition 2018 * ws: edition 2018 idioms * edition 2018: remove whitespaces from cargo fix * core: edition 2018 idioms * http: edition 2018 idioms * derive: edition 2018 idioms * ipc: edition 2018 idioms * pubsub: edition 2018 idioms * Remove more blank lines and unused * Remove all `dyn` keywords for trait objects * Remove anonymous lifetimes * Replace `r#try` with `?` * Remove `extern crate` in doctests * Remove `extern crate` in READMEs * Convert doctest to use derive instead of macros
1 parent 5a7be5f commit 37b62a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+246
-308
lines changed

core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ version = "10.0.0"
88
authors = ["debris <[email protected]>"]
99
keywords = ["jsonrpc", "json-rpc", "json", "rpc", "serde"]
1010
documentation = "https://paritytech.github.io/jsonrpc/jsonrpc_core/index.html"
11+
edition = "2018"
1112

1213
categories = [
1314
"asynchronous",

core/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ jsonrpc-core = "4.0"
1919
`main.rs`
2020

2121
```rust
22-
extern crate jsonrpc_core;
23-
2422
use jsonrpc_core::*;
2523

2624
fn main() {
@@ -41,8 +39,6 @@ fn main() {
4139
`main.rs`
4240

4341
```rust
44-
extern crate jsonrpc_core;
45-
4642
use jsonrpc_core::*;
4743
use jsonrpc_core::futures::Future;
4844

core/examples/async.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate jsonrpc_core;
2-
31
use jsonrpc_core::*;
42
use jsonrpc_core::futures::Future;
53

core/examples/basic.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate jsonrpc_core;
2-
31
use jsonrpc_core::*;
42

53
fn main() {

core/examples/meta.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate jsonrpc_core;
2-
31
use jsonrpc_core::*;
42
use jsonrpc_core::futures::Future;
53

core/examples/middlewares.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate jsonrpc_core;
2-
31
use std::time::Instant;
42
use std::sync::atomic::{self, AtomicUsize};
53
use jsonrpc_core::*;

core/src/calls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::fmt;
22
use std::sync::Arc;
3-
use types::{Params, Value, Error};
3+
use crate::types::{Params, Value, Error};
44
use futures::{Future, IntoFuture};
5-
use BoxFuture;
5+
use crate::BoxFuture;
66

77
/// Metadata trait
88
pub trait Metadata: Clone + Send + 'static {}

core/src/delegates.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
use std::sync::Arc;
44
use std::collections::HashMap;
55

6-
use types::{Params, Value, Error};
7-
use calls::{Metadata, RemoteProcedure, RpcMethod, RpcNotification};
6+
use crate::types::{Params, Value, Error};
7+
use crate::calls::{Metadata, RemoteProcedure, RpcMethod, RpcNotification};
88
use futures::IntoFuture;
9-
use BoxFuture;
9+
use crate::BoxFuture;
1010

1111
struct DelegateAsyncMethod<T, F> {
1212
delegate: Arc<T>,

core/src/io.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use std::ops::{Deref, DerefMut};
55
use serde_json;
66
use futures::{self, future, Future};
77

8-
use calls::{RemoteProcedure, Metadata, RpcMethodSimple, RpcMethod, RpcNotificationSimple, RpcNotification};
9-
use middleware::{self, Middleware};
10-
use types::{Error, ErrorCode, Version};
11-
use types::{Request, Response, Call, Output};
8+
use crate::calls::{RemoteProcedure, Metadata, RpcMethodSimple, RpcMethod, RpcNotificationSimple, RpcNotification};
9+
use crate::middleware::{self, Middleware};
10+
use crate::types::{Error, ErrorCode, Version};
11+
use crate::types::{Request, Response, Call, Output};
1212

1313
/// A type representing middleware or RPC response before serialization.
1414
pub type FutureResponse = Box<Future<Item=Option<Response>, Error=()> + Send>;
@@ -372,7 +372,7 @@ fn write_response(response: Response) -> String {
372372
#[cfg(test)]
373373
mod tests {
374374
use futures;
375-
use types::{Value};
375+
use crate::types::{Value};
376376
use super::{IoHandler, Compatibility};
377377

378378
#[test]

core/src/lib.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
//! Right now it supports only server side handling requests.
44
//!
55
//! ```rust
6-
//! extern crate jsonrpc_core;
7-
//!
86
//! use jsonrpc_core::*;
97
//! use jsonrpc_core::futures::Future;
108
//!
@@ -25,9 +23,8 @@
2523

2624
#[macro_use] extern crate log;
2725
#[macro_use] extern crate serde_derive;
28-
extern crate serde;
2926

30-
pub extern crate futures;
27+
pub use futures;
3128

3229
#[doc(hidden)]
3330
pub extern crate serde_json;
@@ -45,8 +42,8 @@ pub type BoxFuture<T> = Box<futures::Future<Item = T, Error = Error> + Send>;
4542
/// A Result type.
4643
pub type Result<T> = ::std::result::Result<T, Error>;
4744

48-
pub use calls::{RemoteProcedure, Metadata, RpcMethodSimple, RpcMethod, RpcNotificationSimple, RpcNotification};
49-
pub use delegates::IoDelegate;
50-
pub use io::{Compatibility, IoHandler, MetaIoHandler, FutureOutput, FutureResult, FutureResponse, FutureRpcResult};
51-
pub use middleware::{Middleware, Noop as NoopMiddleware};
52-
pub use types::*;
45+
pub use crate::calls::{RemoteProcedure, Metadata, RpcMethodSimple, RpcMethod, RpcNotificationSimple, RpcNotification};
46+
pub use crate::delegates::IoDelegate;
47+
pub use crate::io::{Compatibility, IoHandler, MetaIoHandler, FutureOutput, FutureResult, FutureResponse, FutureRpcResult};
48+
pub use crate::middleware::{Middleware, Noop as NoopMiddleware};
49+
pub use crate::types::*;

0 commit comments

Comments
 (0)