Correct the clippy::use_self lint where possible. (#114)
This commit is contained in:
committed by
Dan Gohman
parent
603f7a9f22
commit
692bb27209
@@ -21,10 +21,10 @@ cfg_if::cfg_if! {
|
||||
impl AsRawFd for Descriptor {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
match self {
|
||||
Descriptor::OsFile(file) => file.as_raw_fd(),
|
||||
Descriptor::Stdin => io::stdin().as_raw_fd(),
|
||||
Descriptor::Stdout => io::stdout().as_raw_fd(),
|
||||
Descriptor::Stderr => io::stderr().as_raw_fd(),
|
||||
Self::OsFile(file) => file.as_raw_fd(),
|
||||
Self::Stdin => io::stdin().as_raw_fd(),
|
||||
Self::Stdout => io::stdout().as_raw_fd(),
|
||||
Self::Stderr => io::stderr().as_raw_fd(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,10 +37,10 @@ impl DerefMut for OsFile {
|
||||
impl AsRawHandle for Descriptor {
|
||||
fn as_raw_handle(&self) -> RawHandle {
|
||||
match self {
|
||||
Descriptor::OsFile(file) => file.as_raw_handle(),
|
||||
Descriptor::Stdin => io::stdin().as_raw_handle(),
|
||||
Descriptor::Stdout => io::stdout().as_raw_handle(),
|
||||
Descriptor::Stderr => io::stderr().as_raw_handle(),
|
||||
Self::OsFile(file) => file.as_raw_handle(),
|
||||
Self::Stdin => io::stdin().as_raw_handle(),
|
||||
Self::Stdout => io::stdout().as_raw_handle(),
|
||||
Self::Stderr => io::stderr().as_raw_handle(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,9 +96,7 @@ pub(crate) unsafe fn determine_type_rights<Handle: AsRawHandle>(
|
||||
)
|
||||
} else if file_type.is_disk() {
|
||||
// disk file: file, dir or disk device
|
||||
let file = std::mem::ManuallyDrop::new(unsafe {
|
||||
File::from_raw_handle(handle.as_raw_handle())
|
||||
});
|
||||
let file = std::mem::ManuallyDrop::new(File::from_raw_handle(handle.as_raw_handle()));
|
||||
let meta = file.metadata().map_err(|_| Error::EINVAL)?;
|
||||
if meta.is_dir() {
|
||||
(
|
||||
|
||||
@@ -4,7 +4,6 @@ use crate::{host, Error, Result};
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::fs::File;
|
||||
use std::os::windows::ffi::{OsStrExt, OsStringExt};
|
||||
use std::os::windows::prelude::AsRawHandle;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub(crate) trait PathGetExt {
|
||||
|
||||
Reference in New Issue
Block a user