forked from proxmox-mirrors/proxmox
sys: clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
e888fa5181
commit
c280f73793
@ -22,9 +22,9 @@ pub struct ReadDirEntry {
|
|||||||
parent_fd: RawFd,
|
parent_fd: RawFd,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<dir::Entry> for ReadDirEntry {
|
impl From<ReadDirEntry> for dir::Entry {
|
||||||
fn into(self) -> dir::Entry {
|
fn from(this: ReadDirEntry) -> dir::Entry {
|
||||||
self.entry
|
this.entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,11 +67,18 @@ impl BorrowMut<dir::Entry> for ReadDirEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ReadDirEntry {
|
impl ReadDirEntry {
|
||||||
|
/// Get the parent directory's file descriptor.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn parent_fd(&self) -> RawFd {
|
pub fn parent_fd(&self) -> RawFd {
|
||||||
self.parent_fd
|
self.parent_fd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the file name as a `&str`.
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// It is up to the user to ensure that the file name is valid utf-8 *before* calling this
|
||||||
|
/// method.
|
||||||
pub unsafe fn file_name_utf8_unchecked(&self) -> &str {
|
pub unsafe fn file_name_utf8_unchecked(&self) -> &str {
|
||||||
std::str::from_utf8_unchecked(self.file_name().to_bytes())
|
std::str::from_utf8_unchecked(self.file_name().to_bytes())
|
||||||
}
|
}
|
||||||
|
@ -135,9 +135,8 @@ pub fn fgetxattr(fd: RawFd, name: &CStr) -> Result<Vec<u8>, nix::errno::Errno> {
|
|||||||
|
|
||||||
/// Set an extended attribute on a file descriptor.
|
/// Set an extended attribute on a file descriptor.
|
||||||
pub fn fsetxattr(fd: RawFd, name: &CStr, data: &[u8]) -> Result<(), nix::errno::Errno> {
|
pub fn fsetxattr(fd: RawFd, name: &CStr, data: &[u8]) -> Result<(), nix::errno::Errno> {
|
||||||
let flags = 0 as libc::c_int;
|
|
||||||
let result = unsafe {
|
let result = unsafe {
|
||||||
libc::fsetxattr(fd, name.as_ptr(), data.as_ptr() as *const libc::c_void, data.len(), flags)
|
libc::fsetxattr(fd, name.as_ptr(), data.as_ptr() as *const libc::c_void, data.len(), 0)
|
||||||
};
|
};
|
||||||
if result < 0 {
|
if result < 0 {
|
||||||
return Err(Errno::last());
|
return Err(Errno::last());
|
||||||
|
@ -31,9 +31,9 @@ pub fn gettid() -> Tid {
|
|||||||
/// of...!
|
/// of...!
|
||||||
pub struct Signal(c_int);
|
pub struct Signal(c_int);
|
||||||
|
|
||||||
impl Into<c_int> for Signal {
|
impl From<Signal> for c_int {
|
||||||
fn into(self) -> c_int {
|
fn from(this: Signal) -> c_int {
|
||||||
self.0
|
this.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user