Skip to content

Commit 1ae5dd8

Browse files
committed
Convert the crate to edition 2018
1 parent 84e66d7 commit 1ae5dd8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+274
-397
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "nix"
33
description = "Rust friendly bindings to *nix APIs"
4+
edition = "2018"
45
version = "0.17.0"
56
authors = ["The nix-rust Project Developers"]
67
repository = "https://github.com/nix-rust/nix"

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,13 @@ Tier 3:
8888

8989
`nix` requires Rust 1.36.0 or newer.
9090

91-
To use `nix`, first add this to your `Cargo.toml`:
91+
To use `nix`, add this to your `Cargo.toml`:
9292

9393
```toml
9494
[dependencies]
9595
nix = "0.17.0"
9696
```
9797

98-
Then, add this to your crate root:
99-
100-
```rust,ignore
101-
extern crate nix;
102-
```
103-
10498
## Contributing
10599

106100
Contributions are very welcome. Please See [CONTRIBUTING](CONTRIBUTING.md) for

build.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#[cfg(target_os = "dragonfly")]
2-
extern crate cc;
3-
41
#[cfg(target_os = "dragonfly")]
52
fn main() {
63
cc::Build::new()

src/dir.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
use {Error, NixPath, Result};
2-
use errno::Errno;
3-
use fcntl::{self, OFlag};
4-
use libc;
1+
use crate::{Error, NixPath, Result};
2+
use crate::errno::Errno;
3+
use crate::fcntl::{self, OFlag};
54
use std::os::unix::io::{AsRawFd, IntoRawFd, RawFd};
65
use std::ptr;
76
use std::ffi;
8-
use sys;
7+
use crate::sys;
98

109
#[cfg(target_os = "linux")]
1110
use libc::{dirent64 as dirent, readdir64_r as readdir_r};

src/env.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use {Error, Result};
1+
use cfg_if::cfg_if;
2+
use crate::{Error, Result};
23

34
/// Clear the environment of all name-value pairs.
45
///

src/errno.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use cfg_if::cfg_if;
12
#[cfg(not(target_os = "dragonfly"))]
2-
use libc;
33
use libc::{c_int, c_void};
44
use std::{fmt, io, error};
5-
use {Error, Result};
5+
use crate::{Error, Result};
66

77
pub use self::consts::*;
88

@@ -584,8 +584,6 @@ fn desc(errno: Errno) -> &'static str {
584584

585585
#[cfg(any(target_os = "linux", target_os = "android"))]
586586
mod consts {
587-
use libc;
588-
589587
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
590588
#[repr(i32)]
591589
pub enum Errno {
@@ -873,8 +871,6 @@ mod consts {
873871

874872
#[cfg(any(target_os = "macos", target_os = "ios"))]
875873
mod consts {
876-
use libc;
877-
878874
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
879875
#[repr(i32)]
880876
pub enum Errno {
@@ -1110,8 +1106,6 @@ mod consts {
11101106

11111107
#[cfg(target_os = "freebsd")]
11121108
mod consts {
1113-
use libc;
1114-
11151109
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
11161110
#[repr(i32)]
11171111
pub enum Errno {
@@ -1328,8 +1322,6 @@ mod consts {
13281322

13291323
#[cfg(target_os = "dragonfly")]
13301324
mod consts {
1331-
use libc;
1332-
13331325
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
13341326
#[repr(i32)]
13351327
pub enum Errno {
@@ -1543,8 +1535,6 @@ mod consts {
15431535

15441536
#[cfg(target_os = "openbsd")]
15451537
mod consts {
1546-
use libc;
1547-
15481538
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
15491539
#[repr(i32)]
15501540
pub enum Errno {
@@ -1757,8 +1747,6 @@ mod consts {
17571747

17581748
#[cfg(target_os = "netbsd")]
17591749
mod consts {
1760-
use libc;
1761-
17621750
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
17631751
#[repr(i32)]
17641752
pub enum Errno {
@@ -1973,8 +1961,6 @@ mod consts {
19731961

19741962
#[cfg(target_os = "redox")]
19751963
mod consts {
1976-
use libc;
1977-
19781964
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
19791965
#[repr(i32)]
19801966
pub enum Errno {

src/fcntl.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
use errno::Errno;
1+
use crate::errno::Errno;
22
use libc::{self, c_char, c_int, c_uint, size_t, ssize_t};
33
use std::ffi::OsString;
44
#[cfg(not(target_os = "redox"))]
55
use std::os::raw;
66
use std::os::unix::ffi::OsStringExt;
77
use std::os::unix::io::RawFd;
8-
use sys::stat::Mode;
9-
use {NixPath, Result};
8+
use crate::sys::stat::Mode;
9+
use crate::{NixPath, Result};
1010

1111
#[cfg(any(target_os = "android", target_os = "linux"))]
1212
use std::ptr; // For splice and copy_file_range
1313
#[cfg(any(target_os = "android", target_os = "linux"))]
14-
use sys::uio::IoVec; // For vmsplice
14+
use crate::sys::uio::IoVec; // For vmsplice
1515

1616
#[cfg(any(
1717
target_os = "linux",
@@ -586,10 +586,10 @@ pub fn fallocate(
586586
target_env = "freebsd"
587587
))]
588588
mod posix_fadvise {
589-
use errno::Errno;
589+
use crate::errno::Errno;
590590
use libc;
591591
use std::os::unix::io::RawFd;
592-
use Result;
592+
use crate::Result;
593593

594594
libc_enum! {
595595
#[repr(i32)]

src/features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub use self::os::*;
33

44
#[cfg(any(target_os = "linux", target_os = "android"))]
55
mod os {
6-
use sys::utsname::uname;
6+
use crate::sys::utsname::uname;
77

88
// Features:
99
// * atomic cloexec on socket: 2.6.27

src/ifaddrs.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
//! Uses the Linux and/or BSD specific function `getifaddrs` to query the list
44
//! of interfaces and their associated addresses.
55
6+
use cfg_if::cfg_if;
67
use std::ffi;
78
use std::iter::Iterator;
89
use std::mem;
910
use std::option::Option;
1011

11-
use libc;
12-
13-
use {Result, Errno};
14-
use sys::socket::SockAddr;
15-
use net::if_::*;
12+
use crate::{Result, Errno};
13+
use crate::sys::socket::SockAddr;
14+
use crate::net::if_::*;
1615

1716
/// Describes a single address for an interface as returned by `getifaddrs`.
1817
#[derive(Clone, Debug, Eq, Hash, PartialEq)]

src/kmod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use libc;
66
use std::ffi::CStr;
77
use std::os::unix::io::AsRawFd;
88

9-
use errno::Errno;
10-
use Result;
9+
use crate::errno::Errno;
10+
use crate::Result;
1111

1212
/// Loads a kernel module from a buffer.
1313
///

0 commit comments

Comments
 (0)