]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/max-min-classes.rs
cleanup: s/impl Copy/#[derive(Copy)]/g
[rust.git] / src / test / run-pass / max-min-classes.rs
index 7247afeacd6fe663d6b9f24a699c6b470ea1a410..e3c375f8b0fdea321aa5019b6ae821bb6cf367fc 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 trait Product {
-    fn product() -> int;
+    fn product(&self) -> int;
 }
 
 struct Foo {
@@ -18,13 +18,13 @@ struct Foo {
 }
 
 impl Foo {
-    fn sum() -> int {
+    pub fn sum(&self) -> int {
         self.x + self.y
     }
 }
 
-impl Foo : Product {
-    fn product() -> int {
+impl Product for Foo {
+    fn product(&self) -> int {
         self.x * self.y
     }
 }
@@ -35,6 +35,5 @@ fn Foo(x: int, y: int) -> Foo {
 
 pub fn main() {
     let foo = Foo(3, 20);
-    io::println(fmt!("%d %d", foo.sum(), foo.product()));
+    println!("{} {}", foo.sum(), foo.product());
 }
-