Clippy fixes

This commit is contained in:
Jeremy Soller
2018-12-01 18:36:17 -07:00
parent 28dab8ece8
commit 52fd4d7e83
38 changed files with 497 additions and 554 deletions
+2 -4
View File
@@ -22,13 +22,11 @@ impl PalSignal for Sys {
fn raise(sig: c_int) -> c_int {
let tid = e(unsafe { syscall!(GETTID) }) as pid_t;
let ret = if tid == !0 {
if tid == !0 {
-1
} else {
e(unsafe { syscall!(TKILL, tid, sig) }) as c_int
};
ret
}
}
unsafe fn sigaction(sig: c_int, act: *const sigaction, oact: *mut sigaction) -> c_int {
+3 -3
View File
@@ -103,7 +103,7 @@ impl Write for StringWriter {
ptr::copy_nonoverlapping(buf.as_ptr(), self.0, copy_size);
self.1 -= copy_size;
self.0 = self.0.offset(copy_size as isize);
self.0 = self.0.add(copy_size);
*self.0 = 0;
}
@@ -136,8 +136,8 @@ impl Write for UnsafeStringWriter {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
unsafe {
ptr::copy_nonoverlapping(buf.as_ptr(), self.0, buf.len());
*self.0.offset(buf.len() as isize) = b'\0';
self.0 = self.0.offset(buf.len() as isize);
self.0 = self.0.add(buf.len());
*self.0 = b'\0';
}
Ok(buf.len())
}
+1 -1
View File
@@ -23,7 +23,7 @@ pub enum Line<'a> {
impl RawLineBuffer {
pub const fn new(fd: c_int) -> Self {
Self {
fd: fd,
fd,
buf: Vec::new(),
newline: None,
read: 0,