Skip to content

Commit 294f57a

Browse files
committed
refactor(shell): Switch away from 'ref mut' patterns
1 parent 54db14f commit 294f57a

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/cargo/core/shell.rs

+14-17
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,11 @@ impl Shell {
232232
/// Updates the color choice (always, never, or auto) from a string..
233233
pub fn set_color_choice(&mut self, color: Option<&str>) -> CargoResult<()> {
234234
if let ShellOut::Stream {
235-
ref mut stdout,
236-
ref mut stderr,
237-
ref mut color_choice,
235+
stdout,
236+
stderr,
237+
color_choice,
238238
..
239-
} = self.output
239+
} = &mut self.output
240240
{
241241
let cfg = color
242242
.map(|c| c.parse())
@@ -253,10 +253,10 @@ impl Shell {
253253

254254
pub fn set_unicode(&mut self, yes: bool) -> CargoResult<()> {
255255
if let ShellOut::Stream {
256-
ref mut stdout_unicode,
257-
ref mut stderr_unicode,
256+
stdout_unicode,
257+
stderr_unicode,
258258
..
259-
} = self.output
259+
} = &mut self.output
260260
{
261261
*stdout_unicode = yes;
262262
*stderr_unicode = yes;
@@ -265,10 +265,7 @@ impl Shell {
265265
}
266266

267267
pub fn set_hyperlinks(&mut self, yes: bool) -> CargoResult<()> {
268-
if let ShellOut::Stream {
269-
ref mut hyperlinks, ..
270-
} = self.output
271-
{
268+
if let ShellOut::Stream { hyperlinks, .. } = &mut self.output {
272269
*hyperlinks = yes;
273270
}
274271
Ok(())
@@ -447,17 +444,17 @@ impl ShellOut {
447444

448445
/// Gets stdout as a `io::Write`.
449446
fn stdout(&mut self) -> &mut dyn Write {
450-
match *self {
451-
ShellOut::Stream { ref mut stdout, .. } => stdout,
452-
ShellOut::Write(ref mut w) => w,
447+
match self {
448+
ShellOut::Stream { stdout, .. } => stdout,
449+
ShellOut::Write(w) => w,
453450
}
454451
}
455452

456453
/// Gets stderr as a `io::Write`.
457454
fn stderr(&mut self) -> &mut dyn Write {
458-
match *self {
459-
ShellOut::Stream { ref mut stderr, .. } => stderr,
460-
ShellOut::Write(ref mut w) => w,
455+
match self {
456+
ShellOut::Stream { stderr, .. } => stderr,
457+
ShellOut::Write(w) => w,
461458
}
462459
}
463460
}

0 commit comments

Comments
 (0)