Rollup merge of #85253 - RafaelKr:patch-1, r=varkor
swap function order for better read flow I was reading this error message for the first time. I was a little bit confused when reading that part: ``` foo.bar(); // we can now use this method since i32 implements the Foo trait ``` At the time I was reading `// we can now use this method` I wasn't sure why. It only made sense when reading on. So swapping these parts results in a better read flow.
This commit is contained in:
commit
36b3c28497
@ -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!
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user