Skip to content

Commit 089b040

Browse files
authored
traits.md: remove unusual formatting
1 parent a4ba60f commit 089b040

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/items/traits.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ The following is an example of declaring `Shape` to be a supertrait of `Circle`.
224224

225225
```rust
226226
trait Shape { fn area(&self) -> f64; }
227-
trait Circle : Shape { fn radius(&self) -> f64; }
227+
trait Circle: Shape { fn radius(&self) -> f64; }
228228
```
229229

230230
And the following is the same example, except using [where clauses].
@@ -244,7 +244,7 @@ trait Circle where Self: Shape {
244244
// A = pi * r^2
245245
// so algebraically,
246246
// r = sqrt(A / pi)
247-
(self.area() /std::f64::consts::PI).sqrt()
247+
(self.area() / std::f64::consts::PI).sqrt()
248248
}
249249
}
250250
```
@@ -253,7 +253,7 @@ This next example calls a supertrait method on a generic parameter.
253253

254254
```rust
255255
# trait Shape { fn area(&self) -> f64; }
256-
# trait Circle : Shape { fn radius(&self) -> f64; }
256+
# trait Circle: Shape { fn radius(&self) -> f64; }
257257
fn print_area_and_radius<C: Circle>(c: C) {
258258
// Here we call the area method from the supertrait `Shape` of `Circle`.
259259
println!("Area: {}", c.area());
@@ -265,7 +265,7 @@ Similarly, here is an example of calling supertrait methods on trait objects.
265265

266266
```rust
267267
# trait Shape { fn area(&self) -> f64; }
268-
# trait Circle : Shape { fn radius(&self) -> f64; }
268+
# trait Circle: Shape { fn radius(&self) -> f64; }
269269
# struct UnitCircle;
270270
# impl Shape for UnitCircle { fn area(&self) -> f64 { std::f64::consts::PI } }
271271
# impl Circle for UnitCircle { fn radius(&self) -> f64 { 1.0 } }

0 commit comments

Comments
 (0)