Skip to content

Commit e796718

Browse files
committed
rm ptr::NonNull
1 parent 9f56bf5 commit e796718

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/uu/chcon/src/fts.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ use std::ffi::{CStr, CString, OsStr};
88
use std::marker::PhantomData;
99
use std::os::raw::{c_int, c_long, c_short};
1010
use std::path::Path;
11-
use std::ptr::NonNull;
1211
use std::{io, iter, ptr, slice};
1312

1413
use crate::errors::{Error, Result};
1514
use crate::os_str_to_c_string;
1615

1716
#[derive(Debug)]
1817
pub(crate) struct FTS {
19-
fts: NonNull<fts_sys::FTS>,
18+
fts: ptr::NonNull<fts_sys::FTS>,
2019

21-
entry: Option<NonNull<fts_sys::FTSENT>>,
20+
entry: Option<ptr::NonNull<fts_sys::FTSENT>>,
2221
_phantom_data: PhantomData<fts_sys::FTSENT>,
2322
}
2423

@@ -52,7 +51,7 @@ impl FTS {
5251
// - `compar` is None.
5352
let fts = unsafe { fts_sys::fts_open(path_argv.as_ptr().cast(), options, None) };
5453

55-
let fts = NonNull::new(fts)
54+
let fts = ptr::NonNull::new(fts)
5655
.ok_or_else(|| Error::from_io("fts_open()", io::Error::last_os_error()))?;
5756

5857
Ok(Self {
@@ -71,7 +70,7 @@ impl FTS {
7170
// pointer assumed to be valid.
7271
let new_entry = unsafe { fts_sys::fts_read(self.fts.as_ptr()) };
7372

74-
self.entry = NonNull::new(new_entry);
73+
self.entry = ptr::NonNull::new(new_entry);
7574
if self.entry.is_none() {
7675
let r = io::Error::last_os_error();
7776
if let Some(0) = r.raw_os_error() {
@@ -110,14 +109,14 @@ impl Drop for FTS {
110109

111110
#[derive(Debug)]
112111
pub(crate) struct EntryRef<'fts> {
113-
pub(crate) pointer: NonNull<fts_sys::FTSENT>,
112+
pub(crate) pointer: ptr::NonNull<fts_sys::FTSENT>,
114113

115114
_fts: PhantomData<&'fts FTS>,
116115
_phantom_data: PhantomData<fts_sys::FTSENT>,
117116
}
118117

119118
impl<'fts> EntryRef<'fts> {
120-
fn new(_fts: &'fts FTS, entry: NonNull<fts_sys::FTSENT>) -> Self {
119+
fn new(_fts: &'fts FTS, entry: ptr::NonNull<fts_sys::FTSENT>) -> Self {
121120
Self {
122121
pointer: entry,
123122
_fts: PhantomData,
@@ -161,7 +160,7 @@ impl<'fts> EntryRef<'fts> {
161160
return None;
162161
}
163162

164-
NonNull::new(entry.fts_path)
163+
ptr::NonNull::new(entry.fts_path)
165164
.map(|path_ptr| {
166165
let path_size = usize::from(entry.fts_pathlen).saturating_add(1);
167166

@@ -174,7 +173,7 @@ impl<'fts> EntryRef<'fts> {
174173
}
175174

176175
pub(crate) fn access_path(&self) -> Option<&Path> {
177-
NonNull::new(self.as_ref().fts_accpath)
176+
ptr::NonNull::new(self.as_ref().fts_accpath)
178177
.map(|path_ptr| {
179178
// SAFETY: `entry.fts_accpath` is a non-null pointer that is assumed to be valid.
180179
unsafe { CStr::from_ptr(path_ptr.as_ptr()) }
@@ -184,7 +183,7 @@ impl<'fts> EntryRef<'fts> {
184183
}
185184

186185
pub(crate) fn stat(&self) -> Option<&libc::stat> {
187-
NonNull::new(self.as_ref().fts_statp).map(|stat_ptr| {
186+
ptr::NonNull::new(self.as_ref().fts_statp).map(|stat_ptr| {
188187
// SAFETY: `entry.fts_statp` is a non-null pointer that is assumed to be valid.
189188
unsafe { stat_ptr.as_ref() }
190189
})

src/uu/numfmt/src/numfmt.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ fn parse_options(args: &ArgMatches) -> Result<NumfmtOptions> {
234234

235235
let invalid = InvalidModes::from_str(args.get_one::<String>(INVALID).unwrap()).unwrap();
236236

237-
let zero_terminated = args.get_flag(options::ZERO_TERMINATED);
237+
let zero_terminated = args.get_flag(ZERO_TERMINATED);
238238

239239
Ok(NumfmtOptions {
240240
transform,
@@ -387,8 +387,8 @@ pub fn uu_app() -> Command {
387387
.value_name("INVALID"),
388388
)
389389
.arg(
390-
Arg::new(options::ZERO_TERMINATED)
391-
.long(options::ZERO_TERMINATED)
390+
Arg::new(ZERO_TERMINATED)
391+
.long(ZERO_TERMINATED)
392392
.short('z')
393393
.help("line delimiter is NUL, not newline")
394394
.action(ArgAction::SetTrue),

0 commit comments

Comments
 (0)