Skip to content

Commit 3cf6f95

Browse files
committed
needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler
1 parent 8ab36a1 commit 3cf6f95

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

library/std/src/sys/windows/fs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ impl File {
548548
let user = super::args::from_wide_to_user_path(
549549
subst.iter().copied().chain([0]).collect(),
550550
)?;
551-
Ok(PathBuf::from(OsString::from_wide(&user.strip_suffix(&[0]).unwrap_or(&user))))
551+
Ok(PathBuf::from(OsString::from_wide(user.strip_suffix(&[0]).unwrap_or(&user))))
552552
} else {
553553
Ok(PathBuf::from(OsString::from_wide(subst)))
554554
}
@@ -874,7 +874,7 @@ impl fmt::Debug for File {
874874
// FIXME(#24570): add more info here (e.g., mode)
875875
let mut b = f.debug_struct("File");
876876
b.field("handle", &self.handle.as_raw_handle());
877-
if let Ok(path) = get_path(&self) {
877+
if let Ok(path) = get_path(self) {
878878
b.field("path", &path);
879879
}
880880
b.finish()
@@ -1193,7 +1193,7 @@ pub fn readlink(path: &Path) -> io::Result<PathBuf> {
11931193
let mut opts = OpenOptions::new();
11941194
opts.access_mode(0);
11951195
opts.custom_flags(c::FILE_FLAG_OPEN_REPARSE_POINT | c::FILE_FLAG_BACKUP_SEMANTICS);
1196-
let file = File::open(&path, &opts)?;
1196+
let file = File::open(path, &opts)?;
11971197
file.readlink()
11981198
}
11991199

@@ -1407,7 +1407,7 @@ pub fn symlink_junction<P: AsRef<Path>, Q: AsRef<Path>>(
14071407
#[allow(dead_code)]
14081408
fn symlink_junction_inner(original: &Path, junction: &Path) -> io::Result<()> {
14091409
let d = DirBuilder::new();
1410-
d.mkdir(&junction)?;
1410+
d.mkdir(junction)?;
14111411

14121412
let mut opts = OpenOptions::new();
14131413
opts.write(true);

library/std/src/sys/windows/handle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl Handle {
189189
}
190190

191191
pub fn write(&self, buf: &[u8]) -> io::Result<usize> {
192-
self.synchronous_write(&buf, None)
192+
self.synchronous_write(buf, None)
193193
}
194194

195195
pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
@@ -202,7 +202,7 @@ impl Handle {
202202
}
203203

204204
pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
205-
self.synchronous_write(&buf, Some(offset))
205+
self.synchronous_write(buf, Some(offset))
206206
}
207207

208208
pub fn try_clone(&self) -> io::Result<Self> {

library/std/src/sys/windows/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub unsafe fn init(_argc: isize, _argv: *const *const u8, _sigpipe: u8) {
6363

6464
// Normally, `thread::spawn` will call `Thread::set_name` but since this thread already
6565
// exists, we have to call it ourselves.
66-
thread::Thread::set_name(&CStr::from_bytes_with_nul_unchecked(b"main\0"));
66+
thread::Thread::set_name(CStr::from_bytes_with_nul_unchecked(b"main\0"));
6767
}
6868

6969
// SAFETY: must be called only once during runtime cleanup.

library/std/src/sys/windows/stdio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usiz
195195
MaybeUninit::slice_assume_init_ref(&utf16[..result as usize])
196196
};
197197

198-
let mut written = write_u16s(handle, &utf16)?;
198+
let mut written = write_u16s(handle, utf16)?;
199199

200200
// Figure out how many bytes of as UTF-8 were written away as UTF-16.
201201
if written == utf16.len() {

0 commit comments

Comments
 (0)