libstd: remove redundant & from &Path::new(...)

fn Path::new<S: AsRef ...>(s: &S) -> &Path

Signed-off-by: NODA, Kai <nodakai@gmail.com>
This commit is contained in:
NODA, Kai
2017-07-18 00:04:46 +08:00
parent 5803f99bd4
commit 2e8859ce4e
4 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -2346,17 +2346,17 @@ fn concurrent_recursive_mkdir() {
#[test]
fn recursive_mkdir_slash() {
check!(fs::create_dir_all(&Path::new("/")));
check!(fs::create_dir_all(Path::new("/")));
}
#[test]
fn recursive_mkdir_dot() {
check!(fs::create_dir_all(&Path::new(".")));
check!(fs::create_dir_all(Path::new(".")));
}
#[test]
fn recursive_mkdir_empty() {
check!(fs::create_dir_all(&Path::new("")));
check!(fs::create_dir_all(Path::new("")));
}
#[test]
+2 -2
View File
@@ -29,7 +29,7 @@ pub fn connect(addr: &SocketAddr) -> Result<TcpStream> {
let mut options = OpenOptions::new();
options.read(true);
options.write(true);
Ok(TcpStream(File::open(&Path::new(path.as_str()), &options)?))
Ok(TcpStream(File::open(Path::new(path.as_str()), &options)?))
}
pub fn connect_timeout(_addr: &SocketAddr, _timeout: Duration) -> Result<TcpStream> {
@@ -177,7 +177,7 @@ pub fn bind(addr: &SocketAddr) -> Result<TcpListener> {
let mut options = OpenOptions::new();
options.read(true);
options.write(true);
Ok(TcpListener(File::open(&Path::new(path.as_str()), &options)?))
Ok(TcpListener(File::open(Path::new(path.as_str()), &options)?))
}
pub fn accept(&self) -> Result<(TcpStream, SocketAddr)> {
+1 -1
View File
@@ -30,7 +30,7 @@ pub fn bind(addr: &SocketAddr) -> Result<UdpSocket> {
let mut options = OpenOptions::new();
options.read(true);
options.write(true);
Ok(UdpSocket(File::open(&Path::new(path.as_str()), &options)?, UnsafeCell::new(None)))
Ok(UdpSocket(File::open(Path::new(path.as_str()), &options)?, UnsafeCell::new(None)))
}
fn get_conn(&self) -> &mut Option<SocketAddr> {
+1 -1
View File
@@ -393,7 +393,7 @@ fn to_child_stdio(&self, readable: bool)
let mut opts = OpenOptions::new();
opts.read(readable);
opts.write(!readable);
let fd = File::open(&Path::new("null:"), &opts)?;
let fd = File::open(Path::new("null:"), &opts)?;
Ok((ChildStdio::Owned(fd.into_fd()), None))
}
}