Skip to content

Commit 11092fe

Browse files
authored
Merge pull request #22 from josephlr/edition
Cleanup, fix warnings, move to 2018 edition
2 parents c394f3d + bdd58be commit 11092fe

21 files changed

+45
-79
lines changed

Cargo.toml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,21 @@ name = "keyutils"
33
version = "0.4.0"
44
authors = ["Ben Boeckel <mathstuf@gmail.com>"]
55
license = "BSD-3-Clause"
6-
description = """
7-
Rust interface to the Linux keyring.
8-
"""
6+
description = "Rust interface to the Linux keyring."
97
repository = "https://github.com/mathstuf/rust-keyutils.git"
10-
homepage = "https://github.com/mathstuf/rust-keyutils.git"
11-
documentation = "https://docs.rs/keyutils/~0.4"
8+
homepage = "https://github.com/mathstuf/rust-keyutils"
9+
documentation = "https://docs.rs/keyutils"
1210
readme = "README.md"
11+
edition = "2018"
1312

1413
[workspace]
1514
members = ["libkeyutils-sys"]
1615

1716
[dependencies]
18-
bitflags = "^1.0"
19-
errno = "~0.2"
20-
itertools = "~0.8"
21-
libkeyutils-sys = { path = "libkeyutils-sys", version = "~0.3.1" }
22-
log = "~0.4"
17+
bitflags = "1.0"
18+
errno = "0.2"
19+
itertools = "0.8"
20+
libkeyutils-sys = { path = "libkeyutils-sys" }
21+
log = "0.4"
2322

24-
libc = "~0.2"
23+
libc = "0.2"

libkeyutils-sys/Cargo.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ name = "libkeyutils-sys"
33
version = "0.3.1"
44
authors = ["Ben Boeckel <mathstuf@gmail.com>"]
55
license = "BSD-3-Clause"
6-
description = """
7-
FFI bindings to libkeyutils.
8-
"""
6+
description = "FFI bindings to libkeyutils."
97
repository = "https://github.com/mathstuf/rust-keyutils.git"
10-
homepage = "https://github.com/mathstuf/rust-keyutils.git"
11-
documentation = "https://docs.rs/libkeyutils-sys/~0.3"
8+
homepage = "https://github.com/mathstuf/rust-keyutils"
129
keywords = ["keyutils"]
1310
links = "keyutils"
11+
edition = "2018"
1412

1513
[dependencies]
16-
libc = "~0.2"
14+
libc = "0.2"

libkeyutils-sys/src/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
// Ignore rustfmt changes in here. The horizontal alignment is too useful to give up.
2828
#![cfg_attr(rustfmt, rustfmt_skip)]
2929

30-
use types::{key_perm_t, key_serial_t};
30+
use crate::types::{key_perm_t, key_serial_t};
3131

3232
pub const KEY_TYPE_USER: &str = "user";
3333
pub const KEY_TYPE_LOGON: &str = "logon";

libkeyutils-sys/src/functions.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2525
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

27-
use crates::libc;
28-
29-
use types::{key_perm_t, key_serial_t};
27+
use crate::types::{key_perm_t, key_serial_t};
3028

3129
#[rustfmt::skip]
3230
extern "C" {

libkeyutils-sys/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
//! - `keyctl(3)`
3838
//! - `keyctl(7)`
3939
40-
mod crates {
41-
pub extern crate libc;
42-
}
43-
4440
mod constants;
4541
mod functions;
4642
mod types;

libkeyutils-sys/src/types.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,5 @@
2626

2727
#![allow(non_camel_case_types)]
2828

29-
use crates::libc;
30-
31-
pub type key_serial_t = libc::int32_t;
32-
pub type key_perm_t = libc::uint32_t;
29+
pub type key_serial_t = i32;
30+
pub type key_perm_t = u32;

src/api.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ use std::result;
3232
use std::str;
3333
use std::time::Duration;
3434

35-
use crates::errno;
36-
use crates::libc;
37-
use crates::libkeyutils_sys::*;
35+
use libkeyutils_sys::*;
36+
use log::error;
3837

39-
use constants::{DefaultKeyring, KeyPermissions, KeyringSerial, Permission, SpecialKeyring};
40-
use keytype::*;
41-
use keytypes;
38+
use crate::constants::{DefaultKeyring, KeyPermissions, KeyringSerial, Permission, SpecialKeyring};
39+
use crate::keytype::*;
40+
use crate::keytypes;
4241

4342
/// Reexport of `Errno` as `Error`.
4443
pub type Error = errno::Errno;
@@ -806,14 +805,8 @@ impl KeyManager {
806805
#[cfg(test)]
807806
mod tests {
808807
use std::thread;
809-
use std::time::Duration;
810808

811-
use crates::libc;
812-
813-
use api::Keyring;
814-
use constants::{Permission, SpecialKeyring};
815-
use keytype::KeyType;
816-
use keytypes;
809+
use super::*;
817810

818811
#[test]
819812
fn test_add_key() {

src/constants.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2525
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

27-
use crates::libkeyutils_sys::*;
27+
use bitflags::bitflags;
28+
use libkeyutils_sys::*;
2829

2930
/// Special keyrings predefined for a process.
3031
pub enum SpecialKeyring {

src/keytypes/asymmetric.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
//! Asymmetric keys
2828
29-
use keytype::*;
29+
use crate::keytype::*;
3030

3131
/// Asymmetric keys support encrypting, decrypting, signing, and verifying data.
3232
///

src/keytypes/big_key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
//! Big keys
2828
29-
use keytype::*;
29+
use crate::keytype::*;
3030

3131
/// Big keys.
3232
///

0 commit comments

Comments
 (0)