Skip to content

Commit

Permalink
Merge pull request #36 from frugalos/feature/rust-2018
Browse files Browse the repository at this point in the history
Adopt Rust 2018
  • Loading branch information
koba-e964 authored Oct 19, 2020
2 parents 046880b + 8aa2298 commit 868811f
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 55 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[package]
edition = "2018"
name = "libfrugalos"
version = "0.7.0"
authors = ["The FrugalOS Developers"]
Expand Down
10 changes: 5 additions & 5 deletions src/client/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use futures::{Async, Future, Poll};
use std::net::SocketAddr;

use super::Response;
use entity::bucket::{Bucket, BucketId, BucketSummary};
use entity::device::{Device, DeviceId, DeviceSummary};
use entity::server::{Server, ServerId, ServerSummary};
use schema::config;
use {Error, ErrorKind, Result};
use crate::entity::bucket::{Bucket, BucketId, BucketSummary};
use crate::entity::device::{Device, DeviceId, DeviceSummary};
use crate::entity::server::{Server, ServerId, ServerSummary};
use crate::schema::config;
use crate::{Error, ErrorKind, Result};

/// RPCクライアント。
#[derive(Debug)]
Expand Down
18 changes: 9 additions & 9 deletions src/client/frugalos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ use std::ops::Range;
use std::time::Duration;

use super::Response;
use consistency::ReadConsistency;
use entity::bucket::BucketId;
use entity::device::DeviceId;
use entity::object::{
use crate::consistency::ReadConsistency;
use crate::entity::bucket::BucketId;
use crate::entity::device::DeviceId;
use crate::entity::object::{
DeleteObjectsByPrefixSummary, FragmentsSummary, ObjectId, ObjectPrefix, ObjectSummary,
ObjectVersion,
};
use expect::Expect;
use multiplicity::MultiplicityConfig;
use repair::RepairConfig;
use schema::frugalos;
use Error;
use crate::expect::Expect;
use crate::multiplicity::MultiplicityConfig;
use crate::repair::RepairConfig;
use crate::schema::frugalos;
use crate::Error;

/// RPCクライアント。
#[derive(Debug)]
Expand Down
12 changes: 6 additions & 6 deletions src/client/mds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use std::ops::Range;
use std::time::Duration;

use super::Response;
use consistency::ReadConsistency;
use entity::node::{LocalNodeId, RemoteNodeId};
use entity::object::{
use crate::consistency::ReadConsistency;
use crate::entity::node::{LocalNodeId, RemoteNodeId};
use crate::entity::object::{
DeleteObjectsByPrefixSummary, Metadata, ObjectId, ObjectPrefix, ObjectSummary, ObjectVersion,
};
use expect::Expect;
use schema::mds;
use {Error, ErrorKind, Result};
use crate::expect::Expect;
use crate::schema::mds;
use crate::{Error, ErrorKind, Result};

/// RPCクライアント。
#[derive(Debug)]
Expand Down
3 changes: 1 addition & 2 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//! RPCクライアント。
use fibers_rpc;
use futures::{Async, Future, Poll};
use trackable::error::ErrorKindExt;

use {Error, ErrorKind, Result};
use crate::{Error, ErrorKind, Result};

pub mod config;
pub mod frugalos;
Expand Down
2 changes: 1 addition & 1 deletion src/entity/bucket.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! バケツ関連のエンティティ定義。
use std::cmp;

use entity::device::DeviceId;
use crate::entity::device::DeviceId;

// FIXME: 構造体に置き換える
/// バケツのID。
Expand Down
12 changes: 3 additions & 9 deletions src/entity/device.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//! デバイス関連のエンティティ定義。
use libc;
use std;
use std::collections::BTreeSet;
use std::path::PathBuf;

use entity::server::ServerId;
use {Error, ErrorKind, Result};
use crate::entity::server::ServerId;
use crate::{Error, ErrorKind, Result};

// FIXME: 構造体に置き換える
/// デバイスのID。
Expand Down Expand Up @@ -91,11 +89,7 @@ impl Device {

/// 仮想デバイスかどうかを判定する。
pub fn is_virtual(&self) -> bool {
if let Device::Virtual(_) = *self {
true
} else {
false
}
matches!(self, Device::Virtual(_))
}

/// デバイスを保持しているサーバを返す。
Expand Down
2 changes: 1 addition & 1 deletion src/entity/object.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! オブジェクト関連のエンティティ定義。
use std::str::FromStr;
use Error;
use crate::Error;

// FIXME: 構造体にする
/// オブジェクトのID。
Expand Down
3 changes: 1 addition & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std;
use trackable::error::{ErrorKind as TrackableErrorKind, ErrorKindExt, TrackableError};

use entity::object::ObjectVersion;
use crate::entity::object::ObjectVersion;

/// クレート固有の`Error`型。
#[derive(Debug, Clone, TrackableError, Serialize, Deserialize)]
Expand Down
4 changes: 2 additions & 2 deletions src/expect.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Compare-And-Swap用の構成要素。
use entity::object::ObjectVersion;
use {ErrorKind, Result};
use crate::entity::object::ObjectVersion;
use crate::{ErrorKind, Result};

/// 操作対象オブジェクトに期待するバージョンを表現するためのデータ構造.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern crate serde_derive;
#[macro_use]
extern crate trackable;

pub use error::{Error, ErrorKind};
pub use crate::error::{Error, ErrorKind};

pub mod client;
pub mod consistency;
Expand Down
8 changes: 4 additions & 4 deletions src/schema/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use bytecodec::bincode_codec::{BincodeDecoder, BincodeEncoder};
use fibers_rpc::{Call, ProcedureId};
use std::net::SocketAddr;

use entity::bucket::{Bucket, BucketId, BucketSummary};
use entity::device::{Device, DeviceId, DeviceSummary};
use entity::server::{Server, ServerId, ServerSummary};
use Result;
use crate::entity::bucket::{Bucket, BucketId, BucketSummary};
use crate::entity::device::{Device, DeviceId, DeviceSummary};
use crate::entity::server::{Server, ServerId, ServerSummary};
use crate::Result;

/// サーバ一覧取得RPC。
#[derive(Debug)]
Expand Down
16 changes: 8 additions & 8 deletions src/schema/frugalos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ use std::collections::BTreeSet;
use std::ops::Range;
use std::time::Duration;

use consistency::ReadConsistency;
use entity::bucket::BucketId;
use entity::device::DeviceId;
use entity::object::{
use crate::consistency::ReadConsistency;
use crate::entity::bucket::BucketId;
use crate::entity::device::DeviceId;
use crate::entity::object::{
DeleteObjectsByPrefixSummary, FragmentsSummary, ObjectId, ObjectPrefix, ObjectSummary,
ObjectVersion,
};
use expect::Expect;
use multiplicity::MultiplicityConfig;
use repair::RepairConfig;
use Result;
use crate::expect::Expect;
use crate::multiplicity::MultiplicityConfig;
use crate::repair::RepairConfig;
use crate::Result;

/// オブジェクト取得RPC。
#[derive(Debug)]
Expand Down
10 changes: 5 additions & 5 deletions src/schema/mds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ use fibers_rpc::{Call, Cast, ProcedureId};
use std::ops::Range;
use std::time::Duration;

use consistency::ReadConsistency;
use entity::node::{LocalNodeId, RemoteNodeId};
use entity::object::{
use crate::consistency::ReadConsistency;
use crate::entity::node::{LocalNodeId, RemoteNodeId};
use crate::entity::object::{
DeleteObjectsByPrefixSummary, Metadata, ObjectId, ObjectPrefix, ObjectSummary, ObjectVersion,
};
use expect::Expect;
use Result;
use crate::expect::Expect;
use crate::Result;

/// Raftのリーダ取得RPC。
#[derive(Debug)]
Expand Down

0 comments on commit 868811f

Please sign in to comment.