Merge branch 'remove-allow-warnings' into 'master'
remove allow warnings and add some lints See merge request redox-os/relibc!1008
This commit is contained in:
+9
-5
@@ -20,16 +20,19 @@ members = [
|
||||
exclude = ["tests", "dlmalloc-rs"]
|
||||
|
||||
[workspace.lints.clippy]
|
||||
cast_lossless = "warn"
|
||||
cast_lossless = "warn" # TODO review occurrences
|
||||
cast_ptr_alignment = "allow" # TODO change to warn or deny when ready to fix
|
||||
mut_from_ref = "allow"
|
||||
ptr_as_ptr = "warn"
|
||||
ptr_cast_constness = "warn"
|
||||
ref_as_ptr = "warn"
|
||||
missing_safety_doc = "allow" # TODO review occurrences
|
||||
mut_from_ref = "allow" # TODO review occurrences
|
||||
ptr_as_ptr = "warn" # TODO review occurrences
|
||||
ptr_cast_constness = "warn" # TODO review occurrences
|
||||
ref_as_ptr = "warn" # TODO review occurrences
|
||||
zero_ptr = "warn" # must allow on public constants due to cbindgen issue
|
||||
|
||||
[workspace.lints.rust]
|
||||
dangling_pointers_from_temporaries = "deny"
|
||||
dead_code = "allow" # TODO review occuurences
|
||||
deprecated = "allow" # TODO review occuurences
|
||||
improper_ctypes_definitions = "deny"
|
||||
internal_features = "allow" # core_intrinsics and lang_items
|
||||
irrefutable_let_patterns = "deny"
|
||||
@@ -39,6 +42,7 @@ non_snake_case = "allow" # TODO review occuurences
|
||||
non_upper_case_globals = "allow" # TODO review occuurences
|
||||
unexpected_cfgs = "deny"
|
||||
unpredictable_function_pointer_comparisons = "deny"
|
||||
unreachable_code = "allow" # TODO review occuurences
|
||||
unsafe_op_in_unsafe_fn = "deny"
|
||||
unused_imports = "deny"
|
||||
unused_must_use = "deny"
|
||||
|
||||
@@ -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,7 +1164,7 @@ 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_sec: time_t::from(useconds / 1_000_000),
|
||||
tv_nsec: ((useconds % 1_000_000) * 1000) as c_long,
|
||||
};
|
||||
let rmtp = ptr::null_mut();
|
||||
|
||||
@@ -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;
|
||||
|
||||
+2
-2
@@ -1383,7 +1383,7 @@ impl<T: Read, U: Read> Read for Chain<T, U> {
|
||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
|
||||
if !self.done_first {
|
||||
match self.first.read(buf)? {
|
||||
0 if buf.len() != 0 => {
|
||||
0 if !buf.is_empty() => {
|
||||
self.done_first = true;
|
||||
}
|
||||
n => return Ok(n),
|
||||
@@ -1406,7 +1406,7 @@ impl<T: BufRead, U: BufRead> BufRead for Chain<T, U> {
|
||||
fn fill_buf(&mut self) -> Result<&[u8]> {
|
||||
if !self.done_first {
|
||||
match self.first.fill_buf()? {
|
||||
buf if buf.len() == 0 => {
|
||||
buf if buf.is_empty() => {
|
||||
self.done_first = true;
|
||||
}
|
||||
buf => return Ok(buf),
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
//! Currently, Linux and Redox syscall backends are supported.
|
||||
|
||||
#![no_std]
|
||||
#![allow(warnings)]
|
||||
#![feature(alloc_error_handler)]
|
||||
#![feature(allocator_api)]
|
||||
#![feature(c_variadic)]
|
||||
|
||||
@@ -517,7 +517,7 @@ impl Pal for Sys {
|
||||
// Note: dev_t is c_long (i64) and __kernel_dev_t is u32; So we need to cast it
|
||||
// and check for overflow
|
||||
let k_dev: c_uint = dev as c_uint;
|
||||
if k_dev as dev_t != dev {
|
||||
if dev_t::from(k_dev) != dev {
|
||||
return Err(Errno(EINVAL));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user