diff --git a/src/features.rs b/src/features.rs index e6c5612daa..1448fdd013 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 5539f77778..b8a2250e06 100644 --- a/src/mqueue.rs +++ b/src/mqueue.rs @@ -114,9 +114,9 @@ pub fn mq_getattr(mqd: MQd) -> Result { 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 { @@ -127,7 +127,7 @@ pub fn mq_setattr(mqd: MQd, newattr: &MqAttr) -> Result { } /// 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 63c7482ddd..edbc973478 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 4854517f1e..22970d8bdc 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::(). +/// `size_of::()`. #[derive(Copy)] pub struct UnixAddr(pub libc::sockaddr_un, pub usize); diff --git a/src/unistd.rs b/src/unistd.rs index c7e889712d..a1200680dd 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) } } }