Skip to content

Commit d81a999

Browse files
committed
Prefer ClassName over Self in example trait implementations
1 parent daa9dca commit d81a999

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/libcore/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ use marker::Sized;
7979
/// }
8080
///
8181
/// impl Clone for Stats {
82-
/// fn clone(&self) -> Self { *self }
82+
/// fn clone(&self) -> Stats { *self }
8383
/// }
8484
/// ```
8585
#[stable(feature = "rust1", since = "1.0.0")]

src/libcore/cmp.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ use option::Option::{self, Some};
7878
/// }
7979
///
8080
/// impl PartialEq for Book {
81-
/// fn eq(&self, other: &Self) -> bool {
81+
/// fn eq(&self, other: &Book) -> bool {
8282
/// self.isbn == other.isbn
8383
/// }
8484
/// }
@@ -147,7 +147,7 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
147147
/// format: BookFormat,
148148
/// }
149149
/// impl PartialEq for Book {
150-
/// fn eq(&self, other: &Self) -> bool {
150+
/// fn eq(&self, other: &Book) -> bool {
151151
/// self.isbn == other.isbn
152152
/// }
153153
/// }
@@ -272,19 +272,19 @@ impl Ordering {
272272
/// }
273273
///
274274
/// impl Ord for Person {
275-
/// fn cmp(&self, other: &Self) -> Ordering {
275+
/// fn cmp(&self, other: &Person) -> Ordering {
276276
/// self.height.cmp(&other.height)
277277
/// }
278278
/// }
279279
///
280280
/// impl PartialOrd for Person {
281-
/// fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
281+
/// fn partial_cmp(&self, other: &Person) -> Option<Ordering> {
282282
/// Some(self.cmp(other))
283283
/// }
284284
/// }
285285
///
286286
/// impl PartialEq for Person {
287-
/// fn eq(&self, other: &Self) -> bool {
287+
/// fn eq(&self, other: &Person) -> bool {
288288
/// self.height == other.height
289289
/// }
290290
/// }
@@ -359,7 +359,7 @@ impl PartialOrd for Ordering {
359359
///
360360
/// ```
361361
/// impl PartialOrd for Person {
362-
/// fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
362+
/// fn partial_cmp(&self, other: &Person) -> Option<Ordering> {
363363
/// Some(self.cmp(other))
364364
/// }
365365
/// }
@@ -379,13 +379,13 @@ impl PartialOrd for Ordering {
379379
/// }
380380
///
381381
/// impl PartialOrd for Person {
382-
/// fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
382+
/// fn partial_cmp(&self, other: &Person) -> Option<Ordering> {
383383
/// self.height.partial_cmp(&other.height)
384384
/// }
385385
/// }
386386
///
387387
/// impl PartialEq for Person {
388-
/// fn eq(&self, other: &Self) -> bool {
388+
/// fn eq(&self, other: &Person) -> bool {
389389
/// self.height == other.height
390390
/// }
391391
/// }

0 commit comments

Comments
 (0)