summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-04-14 12:31:58 +0900
committerHomu <homu@barosl.com>2016-04-14 12:31:58 +0900
commitb7c2f881ae098a03a103c2a015ad29941a814468 (patch)
treec8a31775c09bd1b595c002d823cc2fd20e32abf3
parentabc7b27920222c6776317b93c13170aa50e1f84a (diff)
parent1c802a1959300f7ac9354a2879640927a4cccba5 (diff)
downloadnix-b7c2f881ae098a03a103c2a015ad29941a814468.zip
Auto merge of #350 - llogiq:clippy, r=posborne
fixed a few clippy warnings Just a few style nits. Hope it'll be useful anyway :smile:
-rw-r--r--src/features.rs12
-rw-r--r--src/mqueue.rs8
-rw-r--r--src/sys/ptrace.rs2
-rw-r--r--src/sys/socket/addr.rs4
-rw-r--r--src/unistd.rs2
5 files changed, 14 insertions, 14 deletions
diff --git a/src/features.rs b/src/features.rs
index e6c5612d..1448fdd0 100644
--- a/src/features.rs
+++ b/src/features.rs
@@ -15,15 +15,15 @@ mod os {
static VERS_2_6_28: usize = 4;
static VERS_3: usize = 5;
+ #[inline]
+ fn digit(dst: &mut usize, b: u8) {
+ *dst *= 10;
+ *dst += (b - b'0') as usize;
+ }
+
fn parse_kernel_version() -> usize {
let u = uname();
- #[inline]
- fn digit(dst: &mut usize, b: u8) {
- *dst *= 10;
- *dst += (b - b'0') as usize;
- }
-
let mut curr: usize = 0;
let mut major: usize = 0;
let mut minor: usize = 0;
diff --git a/src/mqueue.rs b/src/mqueue.rs
index 5539f777..b8a2250e 100644
--- a/src/mqueue.rs
+++ b/src/mqueue.rs
@@ -114,9 +114,9 @@ pub fn mq_getattr(mqd: MQd) -> Result<MqAttr> {
Ok(attr)
}
-/// Set the attributes of the message queue. Only O_NONBLOCK can be set, everything else will be ignored
+/// Set the attributes of the message queue. Only `O_NONBLOCK` can be set, everything else will be ignored
/// Returns the old attributes
-/// It is recommend to use the mq_set_nonblock() and mq_remove_nonblock() convenience functions as they are easier to use
+/// It is recommend to use the `mq_set_nonblock()` and `mq_remove_nonblock()` convenience functions as they are easier to use
///
/// [Further reading](http://man7.org/linux/man-pages/man3/mq_setattr.3.html)
pub fn mq_setattr(mqd: MQd, newattr: &MqAttr) -> Result<MqAttr> {
@@ -127,7 +127,7 @@ pub fn mq_setattr(mqd: MQd, newattr: &MqAttr) -> Result<MqAttr> {
}
/// Convenience function.
-/// Sets the O_NONBLOCK attribute for a given message queue descriptor
+/// Sets the `O_NONBLOCK` attribute for a given message queue descriptor
/// Returns the old attributes
pub fn mq_set_nonblock(mqd: MQd) -> Result<(MqAttr)> {
let oldattr = try!(mq_getattr(mqd));
@@ -136,7 +136,7 @@ pub fn mq_set_nonblock(mqd: MQd) -> Result<(MqAttr)> {
}
/// Convenience function.
-/// Removes O_NONBLOCK attribute for a given message queue descriptor
+/// Removes `O_NONBLOCK` attribute for a given message queue descriptor
/// Returns the old attributes
pub fn mq_remove_nonblock(mqd: MQd) -> Result<(MqAttr)> {
let oldattr = try!(mq_getattr(mqd));
diff --git a/src/sys/ptrace.rs b/src/sys/ptrace.rs
index 63c7482d..edbc9734 100644
--- a/src/sys/ptrace.rs
+++ b/src/sys/ptrace.rs
@@ -95,7 +95,7 @@ fn ptrace_other(request: ptrace::PtraceRequest, pid: pid_t, addr: *mut c_void, d
Errno::result(unsafe { ffi::ptrace(request, pid, addr, data) }).map(|_| 0)
}
-/// Set options, as with ptrace(PTRACE_SETOPTIONS,...).
+/// Set options, as with `ptrace(PTRACE_SETOPTIONS,...)`.
pub fn ptrace_setoptions(pid: pid_t, options: ptrace::PtraceOptions) -> Result<()> {
use self::ptrace::*;
use std::ptr;
diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs
index 4854517f..22970d8b 100644
--- a/src/sys/socket/addr.rs
+++ b/src/sys/socket/addr.rs
@@ -348,10 +348,10 @@ impl fmt::Display for Ipv6Addr {
*
*/
-/// A wrapper around sockaddr_un. We track the length of sun_path,
+/// A wrapper around `sockaddr_un`. We track the length of `sun_path`,
/// because it may not be null-terminated (unconnected and abstract
/// sockets). Note that the actual sockaddr length is greater by
-/// size_of::<sa_family_t>().
+/// `size_of::<sa_family_t>()`.
#[derive(Copy)]
pub struct UnixAddr(pub libc::sockaddr_un, pub usize);
diff --git a/src/unistd.rs b/src/unistd.rs
index c7e88971..a1200680 100644
--- a/src/unistd.rs
+++ b/src/unistd.rs
@@ -255,7 +255,7 @@ fn pipe2_setflags(fd1: RawFd, fd2: RawFd, flags: OFlag) -> Result<()> {
Err(e) => {
let _ = close(fd1);
let _ = close(fd2);
- return Err(e);
+ Err(e)
}
}
}