From b552a92bcc6ffd59b5b780b12cab4a25aa5812d2 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 16 Dec 2018 12:29:08 +0100 Subject: Use the crate:: path qualifier for modules This patch changes use declarations for modules within this crate to use the crate:: path qualifier. This will be mandatory in Rust edition 2018. --- src/auth.rs | 12 +++++++----- src/config.rs | 2 +- src/device.rs | 11 ++++++----- src/lib.rs | 12 ++++++------ src/otp.rs | 6 ++++-- src/pws.rs | 5 +++-- 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/auth.rs b/src/auth.rs index 0918222..ef39777 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -1,10 +1,12 @@ -use config::{Config, RawConfig}; -use device::{Device, DeviceWrapper, Pro, Storage}; -use nitrokey_sys; -use otp::{ConfigureOtp, GenerateOtp, OtpMode, OtpSlotData, RawOtpSlotData}; use std::ops::Deref; use std::os::raw::c_int; -use util::{generate_password, get_command_result, get_cstring, result_from_string, CommandError}; + +use nitrokey_sys; + +use crate::config::{Config, RawConfig}; +use crate::device::{Device, DeviceWrapper, Pro, Storage}; +use crate::otp::{ConfigureOtp, GenerateOtp, OtpMode, OtpSlotData, RawOtpSlotData}; +use crate::util::{generate_password, get_command_result, get_cstring, result_from_string, CommandError}; static TEMPORARY_PASSWORD_LENGTH: usize = 25; diff --git a/src/config.rs b/src/config.rs index 33bf256..2ce6f77 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,4 +1,4 @@ -use util::CommandError; +use crate::util::CommandError; /// The configuration for a Nitrokey. #[derive(Clone, Copy, Debug, PartialEq)] diff --git a/src/device.rs b/src/device.rs index cbc826e..86dcc58 100644 --- a/src/device.rs +++ b/src/device.rs @@ -1,10 +1,11 @@ -use auth::Authenticate; -use config::{Config, RawConfig}; use libc; use nitrokey_sys; -use otp::GenerateOtp; -use pws::GetPasswordSafe; -use util::{get_command_result, get_cstring, get_last_error, result_from_string, CommandError}; + +use crate::auth::Authenticate; +use crate::config::{Config, RawConfig}; +use crate::otp::GenerateOtp; +use crate::pws::GetPasswordSafe; +use crate::util::{get_command_result, get_cstring, get_last_error, result_from_string, CommandError}; /// Available Nitrokey models. #[derive(Debug, PartialEq)] diff --git a/src/lib.rs b/src/lib.rs index 2466117..aab717b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -104,12 +104,12 @@ mod pws; mod tests; mod util; -pub use auth::{Admin, Authenticate, User}; -pub use config::Config; -pub use device::{connect, Device, DeviceWrapper, Pro, Storage, StorageStatus, VolumeStatus}; -pub use otp::{ConfigureOtp, GenerateOtp, OtpMode, OtpSlotData}; -pub use pws::{GetPasswordSafe, PasswordSafe, SLOT_COUNT}; -pub use util::{CommandError, LogLevel}; +pub use crate::auth::{Admin, Authenticate, User}; +pub use crate::config::Config; +pub use crate::device::{connect, Device, DeviceWrapper, Pro, Storage, StorageStatus, VolumeStatus}; +pub use crate::otp::{ConfigureOtp, GenerateOtp, OtpMode, OtpSlotData}; +pub use crate::pws::{GetPasswordSafe, PasswordSafe, SLOT_COUNT}; +pub use crate::util::{CommandError, LogLevel}; /// Enables or disables debug output. Calling this method with `true` is equivalent to setting the /// log level to `Debug`; calling it with `false` is equivalent to the log level `Error` (see diff --git a/src/otp.rs b/src/otp.rs index 00a5e5e..801f52c 100644 --- a/src/otp.rs +++ b/src/otp.rs @@ -1,6 +1,8 @@ -use nitrokey_sys; use std::ffi::CString; -use util::{get_command_result, get_cstring, result_from_string, CommandError}; + +use nitrokey_sys; + +use crate::util::{get_command_result, get_cstring, result_from_string, CommandError}; /// Modes for one-time password generation. #[derive(Debug, PartialEq)] diff --git a/src/pws.rs b/src/pws.rs index d73f44c..c95b63b 100644 --- a/src/pws.rs +++ b/src/pws.rs @@ -1,7 +1,8 @@ -use device::{Device, DeviceWrapper, Pro, Storage}; use libc; use nitrokey_sys; -use util::{get_command_result, get_cstring, get_last_error, result_from_string, CommandError}; + +use crate::device::{Device, DeviceWrapper, Pro, Storage}; +use crate::util::{get_command_result, get_cstring, get_last_error, result_from_string, CommandError}; /// The number of slots in a [`PasswordSafe`][]. /// -- cgit v1.2.3