Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cargo-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-06
toolchain: nightly-2019-12-19
components: clippy
profile: minimal
override: true
Expand All @@ -28,7 +28,7 @@ jobs:
fetch-depth: 1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-06
toolchain: nightly-2019-12-19
components: rustfmt
profile: minimal
override: true
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,35 +132,35 @@ You can create a block by sending a transaction through [JSON-RPC](https://githu
## Formatting


Make sure you run `rustfmt` before creating a PR to the repo. You need to install the nightly-2019-11-06 version of `rustfmt`.
Make sure you run `rustfmt` before creating a PR to the repo. You need to install the nightly-2019-12-19 version of `rustfmt`.

```sh
rustup toolchain install nightly-2019-11-06
rustup component add rustfmt --toolchain nightly-2019-11-06
rustup toolchain install nightly-2019-12-19
rustup component add rustfmt --toolchain nightly-2019-12-19
```

To run `rustfmt`,

```sh
cargo +nightly-2019-11-06 fmt
cargo +nightly-2019-12-19 fmt
```

## Linting

You should run `clippy` also. This is a lint tool for rust. It suggests more efficient/readable code.
You can see [the clippy document](https://rust-lang.github.io/rust-clippy/master/index.html) for more information.
You need to install the nightly-2019-11-06 version of `clippy`.
You need to install the nightly-2019-12-19 version of `clippy`.

### Install
```sh
rustup toolchain install nightly-2019-11-06
rustup component add clippy --toolchain nightly-2019-11-06
rustup toolchain install nightly-2019-12-19
rustup component add clippy --toolchain nightly-2019-12-19
```

### Run

```sh
cargo +nightly-2019-11-06 clippy --all --all-targets
cargo +nightly-2019-12-19 clippy --all --all-targets
```

## Testing
Expand Down
38 changes: 19 additions & 19 deletions util/io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,33 @@
//! struct MyHandler;
//!
//! struct MyMessage {
//! data: u32
//! data: u32
//! }
//!
//! impl IoHandler<MyMessage> for MyHandler {
//! fn initialize(&self, io: &IoContext<MyMessage>) -> IoHandlerResult<()> {
//! io.register_timer(0, Duration::from_secs(1));
//! Ok(())
//! }
//! fn initialize(&self, io: &IoContext<MyMessage>) -> IoHandlerResult<()> {
//! io.register_timer(0, Duration::from_secs(1));
//! Ok(())
//! }
//!
//! fn timeout(&self, _io: &IoContext<MyMessage>, timer: TimerToken) -> IoHandlerResult<()> {
//! println!("Timeout {}", timer);
//! Ok(())
//! }
//! fn timeout(&self, _io: &IoContext<MyMessage>, timer: TimerToken) -> IoHandlerResult<()> {
//! println!("Timeout {}", timer);
//! Ok(())
//! }
//!
//! fn message(&self, _io: &IoContext<MyMessage>, message: MyMessage) -> IoHandlerResult<()> {
//! println!("Message {}", message.data);
//! Ok(())
//! }
//! fn message(&self, _io: &IoContext<MyMessage>, message: MyMessage) -> IoHandlerResult<()> {
//! println!("Message {}", message.data);
//! Ok(())
//! }
//! }
//!
//! fn main () {
//! let mut service = IoService::<MyMessage>::start("Test").expect("Error creating network service");
//! service.register_handler(Arc::new(MyHandler)).unwrap();
//! fn main () {
//! let mut service = IoService::<MyMessage>::start("Test").expect("Error creating network service");
//! service.register_handler(Arc::new(MyHandler)).unwrap();
//!
//! // Wait for quit condition
//! // ...
//! // Drop the service
//! // Wait for quit condition
//! // ...
//! // Drop the service
//! }
//! ```

Expand Down