diff --git a/src/uu/chcon/src/fts.rs b/src/uu/chcon/src/fts.rs index a737b5f26..c9a8599fa 100644 --- a/src/uu/chcon/src/fts.rs +++ b/src/uu/chcon/src/fts.rs @@ -8,7 +8,6 @@ use std::ffi::{CStr, CString, OsStr}; use std::marker::PhantomData; use std::os::raw::{c_int, c_long, c_short}; use std::path::Path; -use std::ptr::NonNull; use std::{io, iter, ptr, slice}; use crate::errors::{Error, Result}; @@ -16,9 +15,9 @@ use crate::os_str_to_c_string; #[derive(Debug)] pub(crate) struct FTS { - fts: NonNull, + fts: ptr::NonNull, - entry: Option>, + entry: Option>, _phantom_data: PhantomData, } @@ -52,7 +51,7 @@ impl FTS { // - `compar` is None. let fts = unsafe { fts_sys::fts_open(path_argv.as_ptr().cast(), options, None) }; - let fts = NonNull::new(fts) + let fts = ptr::NonNull::new(fts) .ok_or_else(|| Error::from_io("fts_open()", io::Error::last_os_error()))?; Ok(Self { @@ -71,7 +70,7 @@ impl FTS { // pointer assumed to be valid. let new_entry = unsafe { fts_sys::fts_read(self.fts.as_ptr()) }; - self.entry = NonNull::new(new_entry); + self.entry = ptr::NonNull::new(new_entry); if self.entry.is_none() { let r = io::Error::last_os_error(); if let Some(0) = r.raw_os_error() { @@ -110,14 +109,14 @@ impl Drop for FTS { #[derive(Debug)] pub(crate) struct EntryRef<'fts> { - pub(crate) pointer: NonNull, + pub(crate) pointer: ptr::NonNull, _fts: PhantomData<&'fts FTS>, _phantom_data: PhantomData, } impl<'fts> EntryRef<'fts> { - fn new(_fts: &'fts FTS, entry: NonNull) -> Self { + fn new(_fts: &'fts FTS, entry: ptr::NonNull) -> Self { Self { pointer: entry, _fts: PhantomData, @@ -161,7 +160,7 @@ impl<'fts> EntryRef<'fts> { return None; } - NonNull::new(entry.fts_path) + ptr::NonNull::new(entry.fts_path) .map(|path_ptr| { let path_size = usize::from(entry.fts_pathlen).saturating_add(1); @@ -174,7 +173,7 @@ impl<'fts> EntryRef<'fts> { } pub(crate) fn access_path(&self) -> Option<&Path> { - NonNull::new(self.as_ref().fts_accpath) + ptr::NonNull::new(self.as_ref().fts_accpath) .map(|path_ptr| { // SAFETY: `entry.fts_accpath` is a non-null pointer that is assumed to be valid. unsafe { CStr::from_ptr(path_ptr.as_ptr()) } @@ -184,7 +183,7 @@ impl<'fts> EntryRef<'fts> { } pub(crate) fn stat(&self) -> Option<&libc::stat> { - NonNull::new(self.as_ref().fts_statp).map(|stat_ptr| { + ptr::NonNull::new(self.as_ref().fts_statp).map(|stat_ptr| { // SAFETY: `entry.fts_statp` is a non-null pointer that is assumed to be valid. unsafe { stat_ptr.as_ref() } }) diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 89a0e56b5..c1838d1db 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -227,7 +227,7 @@ fn get_size_on_disk(path: &Path) -> u64 { // bind file so it stays in scope until end of function // if it goes out of scope the handle below becomes invalid - let file = match fs::File::open(path) { + let file = match File::open(path) { Ok(file) => file, Err(_) => return size_on_disk, // opening directories will fail }; @@ -240,7 +240,7 @@ fn get_size_on_disk(path: &Path) -> u64 { file.as_raw_handle() as HANDLE, FileStandardInfo, file_info_ptr as _, - std::mem::size_of::() as u32, + size_of::() as u32, ); if success != 0 { @@ -255,7 +255,7 @@ fn get_size_on_disk(path: &Path) -> u64 { fn get_file_info(path: &Path) -> Option { let mut result = None; - let file = match fs::File::open(path) { + let file = match File::open(path) { Ok(file) => file, Err(_) => return result, }; @@ -268,7 +268,7 @@ fn get_file_info(path: &Path) -> Option { file.as_raw_handle() as HANDLE, FileIdInfo, file_info_ptr as _, - std::mem::size_of::() as u32, + size_of::() as u32, ); if success != 0 { diff --git a/src/uu/numfmt/src/numfmt.rs b/src/uu/numfmt/src/numfmt.rs index ecbdc94f3..cfa7c30d8 100644 --- a/src/uu/numfmt/src/numfmt.rs +++ b/src/uu/numfmt/src/numfmt.rs @@ -234,7 +234,7 @@ fn parse_options(args: &ArgMatches) -> Result { let invalid = InvalidModes::from_str(args.get_one::(INVALID).unwrap()).unwrap(); - let zero_terminated = args.get_flag(options::ZERO_TERMINATED); + let zero_terminated = args.get_flag(ZERO_TERMINATED); Ok(NumfmtOptions { transform, @@ -387,8 +387,8 @@ pub fn uu_app() -> Command { .value_name("INVALID"), ) .arg( - Arg::new(options::ZERO_TERMINATED) - .long(options::ZERO_TERMINATED) + Arg::new(ZERO_TERMINATED) + .long(ZERO_TERMINATED) .short('z') .help("line delimiter is NUL, not newline") .action(ArgAction::SetTrue), diff --git a/src/uu/split/src/platform/windows.rs b/src/uu/split/src/platform/windows.rs index a531d6abc..077a17ccc 100644 --- a/src/uu/split/src/platform/windows.rs +++ b/src/uu/split/src/platform/windows.rs @@ -22,7 +22,7 @@ pub fn instantiate_current_writer( .write(true) .create(true) .truncate(true) - .open(std::path::Path::new(&filename)) + .open(Path::new(&filename)) .map_err(|_| { Error::new( ErrorKind::Other, @@ -33,7 +33,7 @@ pub fn instantiate_current_writer( // re-open file that we previously created to append to it std::fs::OpenOptions::new() .append(true) - .open(std::path::Path::new(&filename)) + .open(Path::new(&filename)) .map_err(|_| { Error::new( ErrorKind::Other,