Skip to content

Commit 86d45ae

Browse files
committed
Fix some clippy warnings
1 parent 2f75cd3 commit 86d45ae

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,15 @@ pub struct Chan<E, P>(Sender<*mut u8>, Receiver<*mut u8>, PhantomData<(E, P)>);
8282

8383
unsafe impl<E: marker::Send, P: marker::Send> marker::Send for Chan<E, P> {}
8484

85-
unsafe fn write_chan<A: marker::Send + 'static, E, P>(&Chan(ref tx, _, _): &Chan<E, P>, x: A) {
85+
unsafe fn write_chan<A: marker::Send + 'static, E, P>(Chan(tx, _, _): &Chan<E, P>, x: A) {
8686
tx.send(Box::into_raw(Box::new(x)) as *mut _).unwrap()
8787
}
8888

89-
unsafe fn read_chan<A: marker::Send + 'static, E, P>(&Chan(_, ref rx, _): &Chan<E, P>) -> A {
89+
unsafe fn read_chan<A: marker::Send + 'static, E, P>(Chan(_, rx, _): &Chan<E, P>) -> A {
9090
*Box::from_raw(rx.recv().unwrap() as *mut A)
9191
}
9292

93-
unsafe fn try_read_chan<A: marker::Send + 'static, E, P>(
94-
&Chan(_, ref rx, _): &Chan<E, P>,
95-
) -> Option<A> {
93+
unsafe fn try_read_chan<A: marker::Send + 'static, E, P>(Chan(_, rx, _): &Chan<E, P>) -> Option<A> {
9694
match rx.try_recv() {
9795
Ok(a) => Some(*Box::from_raw(a as *mut A)),
9896
Err(_) => None,
@@ -404,7 +402,7 @@ pub fn iselect<E, P, A>(chans: &[Chan<E, Recv<A, P>>]) -> usize {
404402
let mut handles = Vec::with_capacity(chans.len()); // collect all the handles
405403

406404
for (i, chan) in chans.iter().enumerate() {
407-
let &Chan(_, ref rx, _) = chan;
405+
let Chan(_, rx, _) = chan;
408406
let handle = sel.recv(rx);
409407
map.insert(handle, i);
410408
handles.push(handle);
@@ -440,12 +438,12 @@ impl<'c> ChanSelect<'c> {
440438
/// Once a channel has been added it cannot be interacted with as long as it
441439
/// is borrowed here (by virtue of borrow checking and lifetimes).
442440
pub fn add_recv<E, P, A: marker::Send>(&mut self, chan: &'c Chan<E, Recv<A, P>>) {
443-
let &Chan(_, ref rx, _) = chan;
441+
let Chan(_, rx, _) = chan;
444442
self.receivers.push(rx);
445443
}
446444

447445
pub fn add_offer<E, P, Q>(&mut self, chan: &'c Chan<E, Offer<P, Q>>) {
448-
let &Chan(_, ref rx, _) = chan;
446+
let Chan(_, rx, _) = chan;
449447
self.receivers.push(rx);
450448
}
451449

0 commit comments

Comments
 (0)