You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clippy_lints/src/inherent_to_string.rs
+17-11Lines changed: 17 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ declare_clippy_lint! {
17
17
///
18
18
/// ** Example:**
19
19
///
20
-
/// ```rust,ignore
20
+
/// ```rust
21
21
/// // Bad
22
22
/// pub struct A;
23
23
///
@@ -26,6 +26,9 @@ declare_clippy_lint! {
26
26
/// "I am A".to_string()
27
27
/// }
28
28
/// }
29
+
/// ```
30
+
///
31
+
/// ```rust
29
32
/// // Good
30
33
/// use std::fmt;
31
34
///
@@ -39,19 +42,19 @@ declare_clippy_lint! {
39
42
/// ```
40
43
pubINHERENT_TO_STRING,
41
44
style,
42
-
"type implements inherent method 'to_string()', but should instead implement the 'Display' trait"
45
+
"type implements inherent method `to_string()`, but should instead implement the `Display` trait"
43
46
}
44
47
45
48
declare_clippy_lint!{
46
49
/// **What id does:** Checks for the definition of inherent methods with a signature of `to_string(&self) -> String` and if the type implementing this method also implements the `Display` trait.
47
50
///
48
-
/// **Why is this bad?** This method is also implicitly defined if a type implements the 'Display' trait. The less versatile inherent method will then shadow the implementation introduced by `Display`.
51
+
/// **Why is this bad?** This method is also implicitly defined if a type implements the `Display` trait. The less versatile inherent method will then shadow the implementation introduced by `Display`.
49
52
///
50
-
/// **Known problems:** The inherent method will shadow the implementation by `Display`. If they behave differently, this may lead to confusing situations for users of the respective type.
53
+
/// **Known problems:** None
51
54
///
52
55
/// ** Example:**
53
56
///
54
-
/// ```rust,ignore
57
+
/// ```rust
55
58
/// // Bad
56
59
/// use std::fmt;
57
60
///
@@ -68,6 +71,9 @@ declare_clippy_lint! {
68
71
/// write!(f, "I am A, too")
69
72
/// }
70
73
/// }
74
+
/// ```
75
+
///
76
+
/// ```rust
71
77
/// // Good
72
78
/// use std::fmt;
73
79
///
@@ -81,7 +87,7 @@ declare_clippy_lint! {
81
87
/// ```
82
88
pubINHERENT_TO_STRING_SHADOW_DISPLAY,
83
89
correctness,
84
-
"type implements inherent method 'to_string()', which gets shadowed by the implementation of the 'Display' trait "
90
+
"type implements inherent method `to_string()`, which gets shadowed by the implementation of the `Display` trait "
0 commit comments