Skip to content

Commit c1f4d71

Browse files
committed
style: remove redundant ref keywords
See <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html> for more details.
1 parent 635625e commit c1f4d71

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

src/diskio/immediate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ impl Executor for ImmediateUnpacker {
6969
fn dispatch(&self, mut item: Item) -> Box<dyn Iterator<Item = CompletedIo> + '_> {
7070
item.result = match &mut item.kind {
7171
super::Kind::Directory => super::create_dir(&item.full_path),
72-
super::Kind::File(ref contents) => {
73-
if let super::FileBuffer::Immediate(ref contents) = &contents {
72+
super::Kind::File(contents) => {
73+
if let super::FileBuffer::Immediate(contents) = &contents {
7474
super::write_file(&item.full_path, contents, item.mode)
7575
} else {
7676
unreachable!()

src/diskio/mod.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ pub(crate) enum FileBuffer {
8181
impl FileBuffer {
8282
/// All the buffers space to be re-used when the last reference to it is dropped.
8383
pub(crate) fn clear(&mut self) {
84-
if let FileBuffer::Threaded(ref mut contents) = self {
84+
if let FileBuffer::Threaded(contents) = self {
8585
contents.clear()
8686
}
8787
}
8888

8989
pub(crate) fn len(&self) -> usize {
9090
match self {
91-
FileBuffer::Immediate(ref vec) => vec.len(),
91+
FileBuffer::Immediate(vec) => vec.len(),
9292
FileBuffer::Threaded(PoolReference::Owned(owned, _)) => owned.len(),
9393
FileBuffer::Threaded(PoolReference::Mut(mutable, _)) => mutable.len(),
9494
}
@@ -109,7 +109,7 @@ impl Deref for FileBuffer {
109109

110110
fn deref(&self) -> &Self::Target {
111111
match self {
112-
FileBuffer::Immediate(ref vec) => vec,
112+
FileBuffer::Immediate(vec) => vec,
113113
FileBuffer::Threaded(PoolReference::Owned(owned, _)) => owned,
114114
FileBuffer::Threaded(PoolReference::Mut(mutable, _)) => mutable,
115115
}
@@ -119,7 +119,7 @@ impl Deref for FileBuffer {
119119
impl DerefMut for FileBuffer {
120120
fn deref_mut(&mut self) -> &mut Self::Target {
121121
match self {
122-
FileBuffer::Immediate(ref mut vec) => vec,
122+
FileBuffer::Immediate(vec) => vec,
123123
FileBuffer::Threaded(PoolReference::Owned(_, _)) => {
124124
unimplemented!()
125125
}
@@ -337,15 +337,11 @@ pub(crate) fn perform<F: Fn(usize)>(item: &mut Item, chunk_complete_callback: F)
337337
// Files, write them.
338338
item.result = match &mut item.kind {
339339
Kind::Directory => create_dir(&item.full_path),
340-
Kind::File(ref mut contents) => {
340+
Kind::File(contents) => {
341341
contents.clear();
342342
match contents {
343-
FileBuffer::Immediate(ref contents) => {
344-
write_file(&item.full_path, contents, item.mode)
345-
}
346-
FileBuffer::Threaded(ref mut contents) => {
347-
write_file(&item.full_path, contents, item.mode)
348-
}
343+
FileBuffer::Immediate(contents) => write_file(&item.full_path, contents, item.mode),
344+
FileBuffer::Threaded(contents) => write_file(&item.full_path, contents, item.mode),
349345
}
350346
}
351347
Kind::IncrementalFile(incremental_file) => write_file_incremental(

src/toolchain.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ impl<'a> Toolchain<'a> {
8787
ActiveReason::CommandLine => {
8888
"the +toolchain on the command line specifies an uninstalled toolchain".to_string()
8989
}
90-
ActiveReason::OverrideDB(ref path) => format!(
90+
ActiveReason::OverrideDB(path) => format!(
9191
"the directory override for '{}' specifies an uninstalled toolchain",
9292
utils::canonicalize_path(path, cfg.notify_handler.as_ref()).display(),
9393
),
94-
ActiveReason::ToolchainFile(ref path) => format!(
94+
ActiveReason::ToolchainFile(path) => format!(
9595
"the toolchain file at '{}' specifies an uninstalled toolchain",
9696
utils::canonicalize_path(path, cfg.notify_handler.as_ref()).display(),
9797
),

0 commit comments

Comments
 (0)