From c341a4747a4cd377bdb5df3ba8faf056151a8f92 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sat, 11 Jan 2025 02:56:58 -0500 Subject: [PATCH] Rename `pos` to `position` --- core/src/ffi/c_str.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/ffi/c_str.rs b/core/src/ffi/c_str.rs index 63915c35288a3..7180593edf0d0 100644 --- a/core/src/ffi/c_str.rs +++ b/core/src/ffi/c_str.rs @@ -127,10 +127,10 @@ pub struct CStr { #[derive(Clone, Copy, PartialEq, Eq, Debug)] #[stable(feature = "core_c_str", since = "1.64.0")] pub enum FromBytesWithNulError { - /// Data provided contains an interior nul byte at byte `pos`. + /// Data provided contains an interior nul byte at byte `position`. InteriorNul { /// The position of the interior nul byte. - pos: usize, + position: usize, }, /// Data provided is not nul terminated. NotNulTerminated, @@ -187,8 +187,8 @@ impl fmt::Display for FromBytesWithNulError { #[allow(deprecated, deprecated_in_future)] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.description())?; - if let Self::InteriorNul { pos } = self { - write!(f, " at byte pos {pos}")?; + if let Self::InteriorNul { position } = self { + write!(f, " at byte pos {position}")?; } Ok(()) } @@ -355,7 +355,7 @@ impl CStr { /// use std::ffi::{CStr, FromBytesWithNulError}; /// /// let cstr = CStr::from_bytes_with_nul(b"he\0llo\0"); - /// assert_eq!(cstr, Err(FromBytesWithNulError::InteriorNul { pos: 2 })); + /// assert_eq!(cstr, Err(FromBytesWithNulError::InteriorNul { position: 2 })); /// ``` #[stable(feature = "cstr_from_bytes", since = "1.10.0")] #[rustc_const_stable(feature = "const_cstr_methods", since = "1.72.0")] @@ -367,7 +367,7 @@ impl CStr { // of the byte slice. Ok(unsafe { Self::from_bytes_with_nul_unchecked(bytes) }) } - Some(pos) => Err(FromBytesWithNulError::InteriorNul { pos }), + Some(position) => Err(FromBytesWithNulError::InteriorNul { position }), None => Err(FromBytesWithNulError::NotNulTerminated), } }