Skip to content

Commit 7d72719

Browse files
author
Jorge Aparicio
committed
fix the &mut _ patterns
1 parent ed4bebd commit 7d72719

File tree

15 files changed

+23
-23
lines changed

15 files changed

+23
-23
lines changed

src/libcollections/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2030,7 +2030,7 @@ mod tests {
20302030
v.push(());
20312031
assert_eq!(v.iter_mut().count(), 4);
20322032

2033-
for &() in v.iter_mut() {}
2033+
for &mut () in v.iter_mut() {}
20342034
unsafe { v.set_len(0); }
20352035
assert_eq!(v.iter_mut().count(), 0);
20362036
}

src/libcore/iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2344,7 +2344,7 @@ impl<A, I, F> RandomAccessIterator for Inspect<A, I, F> where
23442344
///
23452345
/// // This iterator will yield up to the last Fibonacci number before the max value of `u32`.
23462346
/// // You can simply change `u32` to `u64` in this line if you want higher values than that.
2347-
/// let mut fibonacci = Unfold::new((Some(0u32), Some(1u32)), |&(ref mut x2, ref mut x1)| {
2347+
/// let mut fibonacci = Unfold::new((Some(0u32), Some(1u32)), |&mut (ref mut x2, ref mut x1)| {
23482348
/// // Attempt to get the next Fibonacci number
23492349
/// // `x1` will be `None` if previously overflowed.
23502350
/// let next = match (*x2, *x1) {

src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ impl<T> Option<T> {
533533
/// ```
534534
/// let mut x = Some(4u);
535535
/// match x.iter_mut().next() {
536-
/// Some(&ref mut v) => *v = 42u,
536+
/// Some(&mut ref mut v) => *v = 42u,
537537
/// None => {},
538538
/// }
539539
/// assert_eq!(x, Some(42));

src/libcore/result.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ impl<T, E> Result<T, E> {
383383
/// ```
384384
/// fn mutate(r: &mut Result<int, int>) {
385385
/// match r.as_mut() {
386-
/// Ok(&ref mut v) => *v = 42,
387-
/// Err(&ref mut e) => *e = 0,
386+
/// Ok(&mut ref mut v) => *v = 42,
387+
/// Err(&mut ref mut e) => *e = 0,
388388
/// }
389389
/// }
390390
///
@@ -529,7 +529,7 @@ impl<T, E> Result<T, E> {
529529
/// ```
530530
/// let mut x: Result<uint, &str> = Ok(7);
531531
/// match x.iter_mut().next() {
532-
/// Some(&ref mut x) => *x = 40,
532+
/// Some(&mut ref mut x) => *x = 40,
533533
/// None => {},
534534
/// }
535535
/// assert_eq!(x, Ok(40));

src/libcoretest/any.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ fn any_downcast_mut() {
101101
}
102102

103103
match a_r.downcast_mut::<uint>() {
104-
Some(&612) => {}
104+
Some(&mut 612) => {}
105105
x => panic!("Unexpected value {:?}", x)
106106
}
107107

108108
match b_r.downcast_mut::<uint>() {
109-
Some(&413) => {}
109+
Some(&mut 413) => {}
110110
x => panic!("Unexpected value {:?}", x)
111111
}
112112
}

src/librustc_driver/pretty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ impl<'a, 'ast> Iterator for NodesMatchingUII<'a, 'ast> {
350350

351351
fn next(&mut self) -> Option<ast::NodeId> {
352352
match self {
353-
&NodesMatchingDirect(ref mut iter) => iter.next(),
354-
&NodesMatchingSuffix(ref mut iter) => iter.next(),
353+
&mut NodesMatchingDirect(ref mut iter) => iter.next(),
354+
&mut NodesMatchingSuffix(ref mut iter) => iter.next(),
355355
}
356356
}
357357
}

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17091709
/// ! gets replaced with (), unconstrained ints with i32, and unconstrained floats with f64.
17101710
pub fn default_type_parameters(&self) {
17111711
use middle::ty::UnconstrainedNumeric::{UnconstrainedInt, UnconstrainedFloat, Neither};
1712-
for (_, &ref ty) in self.inh.node_types.borrow_mut().iter_mut() {
1712+
for (_, &mut ref ty) in self.inh.node_types.borrow_mut().iter_mut() {
17131713
let resolved = self.infcx().resolve_type_vars_if_possible(ty);
17141714
if self.infcx().type_var_diverges(resolved) {
17151715
demand::eqtype(self, codemap::DUMMY_SP, *ty, ty::mk_nil(self.tcx()));

src/libstd/sync/mpsc/stream.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl<T: Send> Packet<T> {
338338
// upgrade pending, then go through the whole recv rigamarole to update
339339
// the internal state.
340340
match self.queue.peek() {
341-
Some(&GoUp(..)) => {
341+
Some(&mut GoUp(..)) => {
342342
match self.recv() {
343343
Err(Upgraded(port)) => Err(port),
344344
_ => unreachable!(),
@@ -367,7 +367,7 @@ impl<T: Send> Packet<T> {
367367
Ok(()) => SelSuccess,
368368
Err(token) => {
369369
let ret = match self.queue.peek() {
370-
Some(&GoUp(..)) => {
370+
Some(&mut GoUp(..)) => {
371371
match self.queue.pop() {
372372
Some(GoUp(port)) => SelUpgraded(token, port),
373373
_ => unreachable!(),
@@ -457,7 +457,7 @@ impl<T: Send> Packet<T> {
457457
// upgraded port.
458458
if has_data {
459459
match self.queue.peek() {
460-
Some(&GoUp(..)) => {
460+
Some(&mut GoUp(..)) => {
461461
match self.queue.pop() {
462462
Some(GoUp(port)) => Err(port),
463463
_ => unreachable!(),

src/libsyntax/ast_map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<'a, T: Copy> Iterator for Values<'a, T> {
9090
type Item = T;
9191

9292
fn next(&mut self) -> Option<T> {
93-
let &Values(ref mut items) = self;
93+
let &mut Values(ref mut items) = self;
9494
items.next().map(|&x| x)
9595
}
9696
}

src/test/bench/shootout-meteor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn transform(piece: Vec<(int, int)> , all: bool) -> Vec<Vec<(int, int)>> {
118118
// translating to (0, 0) as minimum coordinates.
119119
for cur_piece in res.iter_mut() {
120120
let (dy, dx) = *cur_piece.iter().min_by(|e| *e).unwrap();
121-
for &(ref mut y, ref mut x) in cur_piece.iter_mut() {
121+
for &mut (ref mut y, ref mut x) in cur_piece.iter_mut() {
122122
*y -= dy; *x -= dx;
123123
}
124124
}

0 commit comments

Comments
 (0)