remove allow warnings and add some lints
This commit is contained in:
@@ -163,13 +163,12 @@ fn parse_grp(line: String, destbuf: Option<DestBuffer>) -> Result<OwnedGrp, Erro
|
||||
.collect::<Vec<_>>();
|
||||
let mut buffer = buffer.split_mut(|i| *i == b'\0');
|
||||
|
||||
let mut gr_gid: gid_t = 0;
|
||||
let strings = {
|
||||
let mut vec: Vec<u8> = Vec::new();
|
||||
|
||||
let gr_name = buffer.next().ok_or(Error::EOF)?.to_vec();
|
||||
let gr_passwd = buffer.next().ok_or(Error::EOF)?.to_vec();
|
||||
gr_gid = String::from_utf8(buffer.next().ok_or(Error::EOF)?.to_vec())
|
||||
let gr_gid = String::from_utf8(buffer.next().ok_or(Error::EOF)?.to_vec())
|
||||
.map_err(|err| Error::FromUtf8Error(err))?
|
||||
.parse::<gid_t>()
|
||||
.map_err(|err| Error::ParseIntError(err))?;
|
||||
|
||||
@@ -140,7 +140,7 @@ pub extern "C" fn alarm(seconds: c_uint) -> c_uint {
|
||||
// TODO setitimer is unimplemented on Redox and obsolete
|
||||
let timer = sys_time::itimerval {
|
||||
it_value: timeval {
|
||||
tv_sec: seconds as time_t,
|
||||
tv_sec: time_t::from(seconds),
|
||||
tv_usec: 0,
|
||||
},
|
||||
..Default::default()
|
||||
@@ -1003,7 +1003,7 @@ pub extern "C" fn setuid(uid: uid_t) -> c_int {
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn sleep(seconds: c_uint) -> c_uint {
|
||||
let rqtp = timespec {
|
||||
tv_sec: seconds as time_t,
|
||||
tv_sec: time_t::from(seconds),
|
||||
tv_nsec: 0,
|
||||
};
|
||||
let mut rmtp = timespec {
|
||||
@@ -1164,8 +1164,8 @@ pub unsafe extern "C" fn unlink(path: *const c_char) -> c_int {
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn usleep(useconds: useconds_t) -> c_int {
|
||||
let rqtp = timespec {
|
||||
tv_sec: (useconds / 1_000_000) as time_t,
|
||||
tv_nsec: ((useconds % 1_000_000) * 1000) as c_long,
|
||||
tv_sec: time_t::from(useconds / 1_000_000),
|
||||
tv_nsec: c_long::from((useconds % 1_000_000) * 1000),
|
||||
};
|
||||
let rmtp = ptr::null_mut();
|
||||
unsafe { Sys::nanosleep(&rqtp, rmtp) }
|
||||
|
||||
@@ -365,14 +365,14 @@ pub fn casemap(mut c: u32, dir: i32) -> wint_t {
|
||||
let x = c / 3;
|
||||
let y = c % 3;
|
||||
/* lookup entry in two-level base-6 table */
|
||||
let mut v: c_uint = tab[(tab[b as usize] as u32 * 86 + x) as usize] as c_uint;
|
||||
let mut v: c_uint = c_uint::from(tab[(u32::from(tab[b as usize]) * 86 + x) as usize]);
|
||||
let mt: [c_uint; 3] = [2048, 342, 57];
|
||||
v = (v * mt[y as usize] >> 11) % 6;
|
||||
|
||||
/* use the bit vector out of the tables as an index into
|
||||
* a block-specific set of rules and decode the rule into
|
||||
* a type and a case-mapping delta. */
|
||||
let mut r: c_int = rules[(rulebases[b as usize] as c_uint + v) as usize];
|
||||
let mut r: c_int = rules[(c_uint::from(rulebases[b as usize]) + v) as usize];
|
||||
let mut rt: c_uint = (r & 255) as c_uint;
|
||||
let mut rd: c_int = r >> 8;
|
||||
|
||||
@@ -388,7 +388,7 @@ pub fn casemap(mut c: u32, dir: i32) -> wint_t {
|
||||
let mut xn: c_uint = (rd & 0xff) as c_uint;
|
||||
let mut xb: c_uint = rd as c_uint >> 8;
|
||||
while xn != 0 {
|
||||
let attempt: c_uint = exceptions[(xb + xn / 2) as usize][0] as c_uint;
|
||||
let attempt: c_uint = c_uint::from(exceptions[(xb + xn / 2) as usize][0]);
|
||||
if attempt == c {
|
||||
r = rules[exceptions[(xb + xn / 2) as usize][1] as usize];
|
||||
rt = r as c_uint & 255;
|
||||
|
||||
Reference in New Issue
Block a user