Skip to content

Commit 6cd642e

Browse files
committed
windows: Drop unnecessary &mut self in a few places
Use `&self` rather than `&mut self` in some private methods that do not actually modify the main object. (Mostly because they rely on inner mutability.) This also removes the need for `mut` in a few places in the callers.
1 parent 26b05df commit 6cd642e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/platform/windows/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ impl OsIpcReceiver {
666666
}
667667
}
668668

669-
fn prepare_for_transfer(&mut self) -> Result<bool,WinError> {
669+
fn prepare_for_transfer(&self) -> Result<bool,WinError> {
670670
let mut reader = self.reader.borrow_mut();
671671
// cancel any outstanding IO request
672672
reader.cancel_io();
@@ -760,7 +760,7 @@ impl OsIpcReceiver {
760760
/// Do a pipe connect.
761761
///
762762
/// Only used for one-shot servers.
763-
fn accept(&mut self) -> Result<(),WinError> {
763+
fn accept(&self) -> Result<(),WinError> {
764764
unsafe {
765765
let reader_borrow = self.reader.borrow();
766766
let handle = *reader_borrow.handle;
@@ -1015,7 +1015,7 @@ impl OsIpcSender {
10151015
let mut raw_remote_handle = try!(move_handle_to_process(&mut s.handle, &server_h));
10161016
oob.channel_handles.push(raw_remote_handle.take() as intptr_t);
10171017
},
1018-
OsIpcChannel::Receiver(mut r) => {
1018+
OsIpcChannel::Receiver(r) => {
10191019
if try!(r.prepare_for_transfer()) == false {
10201020
panic!("Sending receiver with outstanding partial read buffer, noooooo! What should even happen?");
10211021
}
@@ -1407,7 +1407,7 @@ impl OsIpcOneShotServer {
14071407
Vec<u8>,
14081408
Vec<OsOpaqueIpcChannel>,
14091409
Vec<OsIpcSharedMemory>),WinError> {
1410-
let mut receiver = self.receiver;
1410+
let receiver = self.receiver;
14111411
try!(receiver.accept());
14121412
let (data, channels, shmems) = try!(receiver.recv());
14131413
Ok((receiver, data, channels, shmems))

0 commit comments

Comments
 (0)