Skip to content

Commit

Permalink
Update to Rust 2018 (#184)
Browse files Browse the repository at this point in the history
* Migrate to Rust 2018

* Remove rust-toolchain file

The toolchains tested on CI are specified in their own ways, so this is only
used for local builds where developers. Its better for developers not to have
this file around in case they have their own preferences.
  • Loading branch information
nrc authored and Hoverbear committed Feb 22, 2019
1 parent a726ccc commit addddd2
Show file tree
Hide file tree
Showing 28 changed files with 128 additions and 139 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ tmp
harness/target

Cargo.lock
rust-toolchain
*.rs.bk
*.rs.fmt
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ homepage = "https://github.com/pingcap/raft-rs"
documentation = "https://docs.rs/raft"
description = "The rust language implementation of Raft algorithm."
categories = ["algorithms", "database-implementations"]
edition = "2018"

[features]
default = []
Expand Down
4 changes: 0 additions & 4 deletions benches/benches.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#![allow(dead_code)] // Due to criterion we need this to avoid warnings.
#![cfg_attr(feature = "cargo-clippy", allow(clippy::let_and_return))] // Benches often artificially return values. Allow it.

extern crate criterion;
extern crate env_logger;
extern crate raft;

use criterion::Criterion;
use std::time::Duration;

Expand Down
2 changes: 1 addition & 1 deletion benches/suites/progress_set.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::DEFAULT_RAFT_SETS;
use criterion::{Bencher, Criterion};
use raft::{Progress, ProgressSet};
use DEFAULT_RAFT_SETS;

pub fn bench_progress_set(c: &mut Criterion) {
bench_progress_set_new(c);
Expand Down
2 changes: 1 addition & 1 deletion benches/suites/raft.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::DEFAULT_RAFT_SETS;
use criterion::{Bencher, Criterion};
use raft::{storage::MemStorage, Config, Raft};
use DEFAULT_RAFT_SETS;

pub fn bench_raft(c: &mut Criterion) {
bench_raft_new(c);
Expand Down
4 changes: 2 additions & 2 deletions examples/single_mem_node/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

extern crate raft;
use raft;

use std::collections::HashMap;
use std::sync::mpsc::{self, RecvTimeoutError};
Expand All @@ -21,7 +21,7 @@ use std::time::{Duration, Instant};
use raft::prelude::*;
use raft::storage::MemStorage;

type ProposeCallback = Box<Fn() + Send>;
type ProposeCallback = Box<dyn Fn() + Send>;

enum Msg {
Propose {
Expand Down
2 changes: 2 additions & 0 deletions generate-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ res = re.sub('::protobuf::rt::read_proto3_enum_with_unknown_fields_into\(([^,]+)
with open("src/eraftpb.rs", "w") as writer:
writer.write(res)
EOF

cargo fix --edition-idioms --allow-dirty
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

Loading

0 comments on commit addddd2

Please sign in to comment.