mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
clippy: fix ptr_cast_constness lint
https://rust-lang.github.io/rust-clippy/master/index.html#ptr_cast_constness
This commit is contained in:
@@ -667,7 +667,6 @@ should_panic_without_expect = "allow" # 2
|
||||
doc_markdown = "allow"
|
||||
unused_self = "allow"
|
||||
enum_glob_use = "allow"
|
||||
ptr_cast_constness = "allow"
|
||||
needless_raw_string_hashes = "allow"
|
||||
unreadable_literal = "allow"
|
||||
unnested_or_patterns = "allow"
|
||||
|
||||
@@ -290,7 +290,7 @@ macro_rules! f {
|
||||
unsafe {
|
||||
let data = $fid(k);
|
||||
if !data.is_null() {
|
||||
Ok($st::from_raw(ptr::read(data as *const _)))
|
||||
Ok($st::from_raw(ptr::read(data.cast_const())))
|
||||
} else {
|
||||
// FIXME: Resource limits, signals and I/O failure may
|
||||
// cause this too. See getpwnam(3).
|
||||
@@ -317,12 +317,12 @@ macro_rules! f {
|
||||
// f!(getgrnam, getgrgid, gid_t, Group);
|
||||
let data = $fnam(cstring.as_ptr());
|
||||
if !data.is_null() {
|
||||
return Ok($st::from_raw(ptr::read(data as *const _)));
|
||||
return Ok($st::from_raw(ptr::read(data.cast_const())));
|
||||
}
|
||||
if let Ok(id) = k.parse::<$t>() {
|
||||
let data = $fid(id);
|
||||
if !data.is_null() {
|
||||
Ok($st::from_raw(ptr::read(data as *const _)))
|
||||
Ok($st::from_raw(ptr::read(data.cast_const())))
|
||||
} else {
|
||||
Err(IOError::new(
|
||||
ErrorKind::NotFound,
|
||||
|
||||
@@ -525,7 +525,7 @@ impl Iterator for UtmpxIter {
|
||||
// All the strings live inline in the struct as arrays, which
|
||||
// makes things easier.
|
||||
Some(UtmpxRecord::Traditional(Box::new(Utmpx {
|
||||
inner: ptr::read(res as *const _),
|
||||
inner: ptr::read(res.cast_const()),
|
||||
})))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user