Merge branch 'clippy' into 'master'

Clippy fixes

See merge request redox-os/relibc!223
This commit is contained in:
jD91mZM2
2019-07-04 14:47:08 +00:00
5 changed files with 10 additions and 14 deletions
+1 -2
View File
@@ -70,8 +70,7 @@ pub fn poll_epoll(fds: &mut [pollfd], timeout: c_int) -> c_int {
return -1;
}
for i in 0..res as usize {
let event = &events[i];
for event in events.iter().take(res as usize) {
let pi = unsafe { event.data.u64 as usize };
// TODO: Error status when fd does not match?
if let Some(pfd) = fds.get_mut(pi) {
+4 -5
View File
@@ -42,9 +42,9 @@ pub fn select_epoll(
File::new(epfd)
};
let mut read_bitset : Option<&mut bitset> = readfds.map(|fd_set| &mut fd_set.fds_bits);
let mut write_bitset : Option<&mut bitset> = writefds.map(|fd_set| &mut fd_set.fds_bits);
let mut except_bitset : Option<&mut bitset> = exceptfds.map(|fd_set| &mut fd_set.fds_bits);
let mut read_bitset: Option<&mut bitset> = readfds.map(|fd_set| &mut fd_set.fds_bits);
let mut write_bitset: Option<&mut bitset> = writefds.map(|fd_set| &mut fd_set.fds_bits);
let mut except_bitset: Option<&mut bitset> = exceptfds.map(|fd_set| &mut fd_set.fds_bits);
// Keep track of the number of file descriptors that do not support epoll
let mut not_epoll = 0;
@@ -129,8 +129,7 @@ pub fn select_epoll(
}
let mut count = not_epoll;
for i in 0..res as usize {
let event = &events[i];
for event in events.iter().take(res as usize) {
let fd = unsafe { event.data.fd };
// TODO: Error status when fd does not match?
if fd >= 0 && fd < FD_SETSIZE as c_int {
+1 -3
View File
@@ -1,7 +1,5 @@
//! time implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/time.h.html
use core::mem::transmute;
use header::errno::EIO;
use platform;
use platform::types::*;
@@ -74,7 +72,7 @@ pub struct sigevent;
#[no_mangle]
pub unsafe extern "C" fn asctime(timeptr: *const tm) -> *mut c_char {
asctime_r(timeptr, transmute::<&mut _, *mut c_char>(&mut ASCTIME))
asctime_r(timeptr, &mut ASCTIME as *mut [i8; 26] as *mut i8)
}
#[no_mangle]
+3 -4
View File
@@ -480,12 +480,11 @@ impl Linker {
}
};
match rel.r_type {
reloc::R_X86_64_IRELATIVE => unsafe {
if rel.r_type == reloc::R_X86_64_IRELATIVE {
unsafe {
let f: unsafe extern "C" fn() -> u64 = mem::transmute(b + a);
set_u64(f());
},
_ => (),
}
}
}
+1
View File
@@ -32,6 +32,7 @@ impl RawLineBuffer {
// Can't use iterators because we want to return a reference.
// See https://stackoverflow.com/a/30422716/5069285
#[allow(clippy::should_implement_trait)]
pub fn next(&mut self) -> Line {
// Remove last line
if let Some(newline) = self.newline {