Skip to content

Commit a08eda4

Browse files
committed
test: Residual de-muting of the test suite. rs=demuting
1 parent 4b9b328 commit a08eda4

22 files changed

+174
-186
lines changed

src/test/auxiliary/cci_class.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
pub mod kitties {
1212
pub struct cat {
13-
priv mut meows : uint,
13+
priv meows : uint,
1414

1515
how_hungry : int,
1616
}

src/test/auxiliary/cci_class_2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
pub mod kitties {
1212
pub struct cat {
13-
priv mut meows : uint,
13+
priv meows : uint,
1414

1515
how_hungry : int,
1616

src/test/auxiliary/cci_class_3.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
pub mod kitties {
1212
pub struct cat {
13-
priv mut meows : uint,
13+
priv meows : uint,
1414

1515
how_hungry : int,
1616
}
1717

1818
pub impl cat {
19-
fn speak() { self.meows += 1u; }
20-
fn meow_count() -> uint { self.meows }
19+
fn speak(&mut self) { self.meows += 1u; }
20+
fn meow_count(&mut self) -> uint { self.meows }
2121
}
2222

2323
pub fn cat(in_x : uint, in_y : int) -> cat {

src/test/auxiliary/cci_class_4.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,29 @@
1010

1111
pub mod kitties {
1212
pub struct cat {
13-
priv mut meows : uint,
13+
priv meows : uint,
1414

15-
mut how_hungry : int,
15+
how_hungry : int,
1616
name : ~str,
1717
}
1818

1919
pub impl cat {
20-
fn speak() { self.meow(); }
20+
fn speak(&mut self) { self.meow(); }
2121

22-
fn eat() -> bool {
23-
if self.how_hungry > 0 {
24-
error!("OM NOM NOM");
25-
self.how_hungry -= 2;
26-
return true;
27-
}
28-
else {
29-
error!("Not hungry!");
30-
return false;
22+
fn eat(&mut self) -> bool {
23+
if self.how_hungry > 0 {
24+
error!("OM NOM NOM");
25+
self.how_hungry -= 2;
26+
return true;
27+
} else {
28+
error!("Not hungry!");
29+
return false;
30+
}
3131
}
32-
}
3332
}
3433

3534
pub impl cat {
36-
fn meow() {
35+
fn meow(&mut self) {
3736
error!("Meow");
3837
self.meows += 1u;
3938
if self.meows % 5u == 0u {

src/test/auxiliary/cci_class_6.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010

1111
pub mod kitties {
1212
pub struct cat<U> {
13-
priv mut info : ~[U],
14-
priv mut meows : uint,
13+
priv info : ~[U],
14+
priv meows : uint,
1515

1616
how_hungry : int,
1717
}
1818

1919
pub impl<U> cat<U> {
20-
fn speak<T>(stuff: ~[T]) {
20+
fn speak<T>(&mut self, stuff: ~[T]) {
2121
self.meows += stuff.len();
2222
}
23-
fn meow_count() -> uint { self.meows }
23+
fn meow_count(&mut self) -> uint { self.meows }
2424
}
2525

2626
pub fn cat<U>(in_x : uint, in_y : int, -in_info: ~[U]) -> cat<U> {

src/test/auxiliary/cci_class_cast.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use core::to_str::*;
1212

1313
pub mod kitty {
1414
pub struct cat {
15-
priv mut meows : uint,
16-
mut how_hungry : int,
15+
priv meows : uint,
16+
how_hungry : int,
1717
name : ~str,
1818
}
1919

@@ -22,7 +22,7 @@ pub mod kitty {
2222
}
2323

2424
priv impl cat {
25-
fn meow() {
25+
fn meow(&mut self) {
2626
error!("Meow");
2727
self.meows += 1u;
2828
if self.meows % 5u == 0u {
@@ -33,9 +33,9 @@ pub mod kitty {
3333
}
3434

3535
pub impl cat {
36-
fn speak() { self.meow(); }
36+
fn speak(&mut self) { self.meow(); }
3737

38-
fn eat() -> bool {
38+
fn eat(&mut self) -> bool {
3939
if self.how_hungry > 0 {
4040
error!("OM NOM NOM");
4141
self.how_hungry -= 2;

src/test/auxiliary/cci_class_trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
pub mod animals {
1212
pub trait noisy {
13-
fn speak();
13+
fn speak(&mut self);
1414
}
1515
}

src/test/run-pass/class-cast-to-trait.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
// except according to those terms.
1010

1111
trait noisy {
12-
fn speak();
12+
fn speak(&mut self);
1313
}
1414

1515
struct cat {
16-
priv mut meows : uint,
17-
mut how_hungry : int,
18-
name : ~str,
16+
priv meows: uint,
17+
how_hungry: int,
18+
name: ~str,
1919
}
2020

2121
impl noisy for cat {
22-
fn speak() { self.meow(); }
22+
fn speak(&mut self) { self.meow(); }
2323
}
2424

2525
impl cat {
26-
fn eat() -> bool {
26+
fn eat(&mut self) -> bool {
2727
if self.how_hungry > 0 {
2828
error!("OM NOM NOM");
2929
self.how_hungry -= 2;
@@ -37,7 +37,7 @@ impl cat {
3737
}
3838

3939
priv impl cat {
40-
fn meow() {
40+
fn meow(&mut self) {
4141
error!("Meow");
4242
self.meows += 1u;
4343
if self.meows % 5u == 0u {
@@ -56,6 +56,6 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
5656

5757

5858
pub fn main() {
59-
let nyan : noisy = cat(0u, 2, ~"nyan") as noisy;
59+
let mut nyan: noisy = cat(0u, 2, ~"nyan") as noisy;
6060
nyan.speak();
6161
}

src/test/run-pass/class-impl-very-parameterized-trait.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ impl cmp::Eq for cat_type {
2828
// ok: T should be in scope when resolving the trait ref for map
2929
struct cat<T> {
3030
// Yes, you can have negative meows
31-
priv mut meows : int,
31+
priv meows : int,
3232

33-
mut how_hungry : int,
33+
how_hungry : int,
3434
name : T,
3535
}
3636

@@ -95,11 +95,10 @@ impl<T> Map<int, T> for cat<T> {
9595
}
9696

9797
fn remove(&mut self, k: &int) -> bool {
98-
match self.find(k) {
99-
Some(_) => {
100-
self.meows -= *k; true
101-
}
102-
None => { false }
98+
if self.find(k).is_some() {
99+
self.meows -= *k; true
100+
} else {
101+
false
103102
}
104103
}
105104
}

src/test/run-pass/class-implement-trait-cross-crate.rs

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,37 @@ extern mod cci_class_trait;
1414
use cci_class_trait::animals::*;
1515

1616
struct cat {
17-
priv mut meows : uint,
17+
priv meows: uint,
1818

19-
mut how_hungry : int,
19+
how_hungry : int,
2020
name : ~str,
2121
}
2222

2323
impl cat {
24-
fn eat() -> bool {
25-
if self.how_hungry > 0 {
26-
error!("OM NOM NOM");
27-
self.how_hungry -= 2;
28-
return true;
24+
fn eat(&mut self) -> bool {
25+
if self.how_hungry > 0 {
26+
error!("OM NOM NOM");
27+
self.how_hungry -= 2;
28+
return true;
29+
}
30+
else {
31+
error!("Not hungry!");
32+
return false;
33+
}
2934
}
30-
else {
31-
error!("Not hungry!");
32-
return false;
33-
}
34-
}
3535
}
3636

3737
impl noisy for cat {
38-
39-
fn speak() { self.meow(); }
40-
38+
fn speak(&mut self) { self.meow(); }
4139
}
4240

4341
priv impl cat {
44-
fn meow() {
45-
error!("Meow");
46-
self.meows += 1u;
47-
if self.meows % 5u == 0u {
48-
self.how_hungry += 1;
49-
}
42+
fn meow(&mut self) {
43+
error!("Meow");
44+
self.meows += 1u;
45+
if self.meows % 5u == 0u {
46+
self.how_hungry += 1;
47+
}
5048
}
5149
}
5250

@@ -60,7 +58,7 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
6058

6159

6260
pub fn main() {
63-
let nyan = cat(0u, 2, ~"nyan");
61+
let mut nyan = cat(0u, 2, ~"nyan");
6462
nyan.eat();
6563
assert(!nyan.eat());
6664
for uint::range(1u, 10u) |_i| { nyan.speak(); };

src/test/run-pass/class-implement-traits.rs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,41 @@
1212
#[legacy_modes];
1313

1414
trait noisy {
15-
fn speak();
15+
fn speak(&mut self);
1616
}
1717

1818
struct cat {
19-
priv mut meows : uint,
19+
priv meows : uint,
2020

21-
mut how_hungry : int,
22-
name : ~str,
21+
how_hungry : int,
22+
name : ~str,
2323
}
2424

2525
priv impl cat {
26-
fn meow() {
27-
error!("Meow");
28-
self.meows += 1u;
29-
if self.meows % 5u == 0u {
30-
self.how_hungry += 1;
31-
}
26+
fn meow(&mut self) {
27+
error!("Meow");
28+
self.meows += 1u;
29+
if self.meows % 5u == 0u {
30+
self.how_hungry += 1;
31+
}
3232
}
3333
}
3434

3535
impl cat {
36-
fn eat() -> bool {
37-
if self.how_hungry > 0 {
38-
error!("OM NOM NOM");
39-
self.how_hungry -= 2;
40-
return true;
36+
fn eat(&mut self) -> bool {
37+
if self.how_hungry > 0 {
38+
error!("OM NOM NOM");
39+
self.how_hungry -= 2;
40+
return true;
41+
} else {
42+
error!("Not hungry!");
43+
return false;
44+
}
4145
}
42-
else {
43-
error!("Not hungry!");
44-
return false;
45-
}
46-
}
4746
}
4847

4948
impl noisy for cat {
50-
fn speak() { self.meow(); }
49+
fn speak(&mut self) { self.meow(); }
5150
}
5251

5352
fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
@@ -59,12 +58,12 @@ fn cat(in_x : uint, in_y : int, in_name: ~str) -> cat {
5958
}
6059

6160

62-
fn make_speak<C:noisy>(c: C) {
61+
fn make_speak<C:noisy>(mut c: C) {
6362
c.speak();
6463
}
6564

6665
pub fn main() {
67-
let nyan = cat(0u, 2, ~"nyan");
66+
let mut nyan = cat(0u, 2, ~"nyan");
6867
nyan.eat();
6968
assert(!nyan.eat());
7069
for uint::range(1u, 10u) |_i| { make_speak(nyan); };

src/test/run-pass/class-methods-cross-crate.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ extern mod cci_class_3;
1414
use cci_class_3::kitties::*;
1515

1616
pub fn main() {
17-
let nyan : cat = cat(52u, 99);
18-
let kitty = cat(1000u, 2);
19-
assert(nyan.how_hungry == 99);
20-
assert(kitty.how_hungry == 2);
21-
nyan.speak();
22-
assert(nyan.meow_count() == 53u);
17+
let mut nyan : cat = cat(52u, 99);
18+
let mut kitty = cat(1000u, 2);
19+
assert(nyan.how_hungry == 99);
20+
assert(kitty.how_hungry == 2);
21+
nyan.speak();
22+
assert(nyan.meow_count() == 53u);
2323
}

0 commit comments

Comments
 (0)