swap function order for better read flow

When having the order

```
foo.bar(); // we can now use this method since i32 implements the Foo trait

[...]

impl Foo for i32
```

the `// we can now use this method` comment is less clear to me.
This commit is contained in:
Rafael Kraut 2021-05-13 13:22:24 +02:00 committed by GitHub
parent 703f2e1685
commit a56d0e2f6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,16 +29,16 @@ trait Foo {
fn bar(&self);
}
fn some_func<T: Foo>(foo: T) {
foo.bar(); // we can now use this method since i32 implements the
// Foo trait
}
// we implement the trait on the i32 type
impl Foo for i32 {
fn bar(&self) {}
}
fn some_func<T: Foo>(foo: T) {
foo.bar(); // we can now use this method since i32 implements the
// Foo trait
}
fn main() {
some_func(5i32); // ok!
}